Menu

Our service was slow, and the database was bored
πŸ“°

Our service was slow, and the database was bored

DEV Community: rustΒ·Marco MengelkochΒ·about 13 hours ago
#Q49ElEo6
#devtorust#devto#dev#database#requests
Reading 0:00
15s threshold

A service I measured stopped at about 18,000 requests per second. Adding more concurrent clients didn't move it: 64 clients, 1,000 clients, 4,000 clients, all 18,000. The obvious suspects were the database and the code. Neither was the problem. The database was mostly idle.

After one change, the same database on the same laptop answered about 252,000 requests per second, and the slowest requests got about ten times faster. This post explains that change without code, and when it's worth asking your team about it.

Where the time went

Each request needed one record, say one customer. It asked the database for it, waited for the answer, and went on.

Finding one record is very fast for a database. What costs time is everything around it: the request travelling to the database, the database reading the question, and the answer travelling back. That round trip is the same whether you ask for one record or for a hundred.

Think of a delivery service that sends a separate van for every parcel to the same street.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.