Works on this device
Query Throughput Calculator
Work out the queries each second (QPS) a database handles from the queries in progress and their latency, the concurrency a target rate needs, how busy the workers are, or the rate from a count of queries. You type every figure; nothing is measured.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Calculate.
Your result
How it was worked out
How to use this calculator
- Choose what you want to work out. Queries each second from concurrency and latency is the first choice.
- Type the figures from your monitoring: queries in progress, mean latency, a rate, or two readings of a counter.
- Choose Calculate. Each result shows the working with the exact numbers.
The formulas
- Little's law: queries in progress = queries each second × mean latency. So QPS = concurrency ÷ latency, and concurrency = QPS × latency.
- Utilisation: use of the workers = QPS × service time of one query ÷ workers. The most QPS at 100% use = workers ÷ service time.
- Clients that pause: QPS = clients ÷ (latency + think time).
- From a count: QPS = queries counted ÷ seconds. From a counter: (second reading − first reading) ÷ seconds between them.
Worked examples
Concurrency and latency: 32 queries in progress with a mean latency of 8 ms give 32 ÷ 0.008 = 4,000 queries each second.
Concurrency for a rate: 2,400 queries each second at 8 ms keep 2,400 × 0.008 = 19.2 queries in progress, so at least 20 connections.
Utilisation: 2,400 queries each second with a service time of 5 ms keep 12 workers busy. With 16 workers that is 75% use. At a target of 70%, 16 workers allow 16 ÷ 0.005 × 0.7 = 2,240 queries each second.
Counter: the counter read 1,048,576,000 and 60 seconds later 1,048,720,000. That is 144,000 queries in 60 s, or 2,400 each second.
Clients: 200 clients with a latency of 20 ms and a think time of 980 ms send 200 ÷ 1 s = 200 queries each second; on average 4 of them are in progress.
Other tools for the same subject
- To size the connection pool for a rate, use the Connection Pool Calculator.
- For connections open at the same time from a rate and a duration, use the Concurrent Connection Calculator.
- To size a pool of worker threads, use the Thread Pool Size Calculator.
- To see which connection limit fills first, use the Connection Saturation Calculator.
Limits you should know
- These are averages over a steady period. The busiest second is higher, so keep room to spare.
- Latency is not fixed: it rises as the database gets busier. A rate worked out at a low load may not hold at a high load.
- The tool reads no database and runs no query. Every figure is the one you type.