Quick revision
The short answer
Little's law says the average number of requests in a system equals the arrival rate times the average time each spends inside: 400 requests per second x 0.15 seconds = 60 concurrent requests on average. So the service needs at least 60 threads busy at once, and pools must be sized above that average to absorb peaks and latency spikes. If each request holds a database connection for only 50 ms, it needs about 400 x 0.05 = 20 connections on average, and headroom should be planned from latency percentiles, not averages.
What to remember
In this answer, we saw that Little's law, concurrency equals arrival rate times time in system, gives 400 x 0.15 = 60 concurrent requests and 400 x 0.05 = 20 database connections on average for our service. Read backwards, it tells us the throughput a pool can support. Because traffic and latency vary, we size threads and pools above the average, plan headroom from percentiles, and remember that the per-pod pool multiplied by the number of pods must fit what the database can handle.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Little's law says the average number of requests in a system equals the arrival rate times the average time each spends inside: 400 requests per second x 0.15 seconds = 60 concurrent requests on average. So the service needs at least 60 threads busy at once, and pools must be sized above that average to absorb peaks and latency spikes. If each request holds a database connection for only 50 ms, it needs about 400 x 0.05 = 20 connections on average, and headroom should be planned from latency percentiles, not averages.
Why this question is asked
Pool sizes are often chosen by guessing: 200 threads because it is the default, 10 connections because it is HikariCP's default. Little's law turns that guess into arithmetic. Interviewers ask this question because it shows whether we can connect throughput, latency and concurrency, and whether we understand why averages are not enough for sizing. In this answer, we will recap Little's law, apply it to threads and to database connections, see why we need headroom, and look at how percentiles change the numbers.
1A Quick Recap of Little's Law
Little's law comes from queueing theory. For any stable system, where on average as much leaves as arrives, the average number of items inside the system (L) equals the average arrival rate (lambda) times the average time each item spends inside (W). In short, L = lambda x W. It holds no matter how arrivals are distributed or in what order items are served, which is why it is so useful.
An everyday example makes it intuitive. If 2 customers enter a coffee shop every minute and each stays 15 minutes, there are on average 2 x 15 = 30 customers inside. For a web service, the customers are requests, the arrival rate is requests per second, and the time inside is the request latency.
2Applying It to the Service
Our service receives 400 requests per second with an average latency of 150 ms. We must use the same unit for both, so 150 ms becomes 0.15 seconds.
So at any moment about 60 requests are in progress. In a Spring Boot service on Tomcat with platform threads, each in-progress request occupies a worker thread, so on average 60 threads are busy. Tomcat's default maximum of 200 threads is enough on average, but that is not the end of the story.
3Applying It to the Connection Pool
The same law works for any resource, as long as we use the time the resource is held, not the whole request time. Suppose each request holds a database connection for 50 ms of its 150 ms, the rest being spent on JSON, other calls and business logic.
| Resource | Time held | Average in use at 400/s |
|---|---|---|
| Request (worker thread) | 150 ms | 60 |
| Database connection | 50 ms | 20 |
| Connection held during a 300 ms remote call | 350 ms | 140 |
Notice that the same law, read backwards, gives the maximum throughput of a pool: 10 connections, each held for 50 ms, can serve at most 200 requests per second. At 400 requests per second, requests would queue for connections and latency would climb. This is also why holding a connection during a slow remote call is so expensive: it increases W for the pool without doing database work.
4Why We Size Above the Average
Little's law gives the average, and averages are what we should never size to exactly. Traffic is not smooth: 400 requests per second on average might be 600 in a busy second. Latency is not constant either: if a garbage collection pause or a slow query raises latency to 400 ms for a few seconds, the concurrency at that moment is 400 x 0.4 = 160 threads, and the connection need rises in the same way.
There is also a queueing effect. When a pool is almost always fully used, any small burst creates a queue, and waiting time grows sharply as utilisation approaches 100 percent. A common rule of thumb is to keep average utilisation of a pool well below its size, for example around 50 to 70 percent, so bursts are absorbed rather than queued.
5Using Percentiles for Headroom
So instead of the average latency, we plan with percentiles: the p99 latency is the time within which 99 percent of requests finish. If p99 is 400 ms at a peak rate of 600 requests per second, the peak concurrency is about 600 x 0.4 = 240 in-flight requests, and if p99 connection hold time is 120 ms, the pool needs around 600 x 0.12 = 72 connections at peak. That is a much more honest number than 20.
This does not mean we set the pool to 72 blindly. Each pod has its own pool, so with six pods the database sees six times the pool size, and the database has its own limit on useful concurrent work. Little's law tells us how much concurrency the traffic needs; the database tells us how much it can actually handle. If the two disagree, the fix is shorter hold times, caching or more database capacity, not just bigger pools.
6Follow-up questions
Does Little's law change with virtual threads?
The law itself does not change: 60 requests are still in progress on average. What changes is the cost of each in-progress request. With virtual threads, the thread pool stops being a limit because threads are cheap, so the bottleneck moves to the next resource, usually the connection pool or a downstream service. That makes connection pool sizing even more important.
How do you measure the time a connection is held?
HikariCP publishes metrics through Micrometer, including hikaricp.connections.usage, the time connections are held, and hikaricp.connections.acquire, the time spent waiting for one. Multiplying the request rate by the usage time gives the average number of connections in use, which we can compare with hikaricp.connections.active as a check.
What does it mean if measured concurrency is much higher than lambda x W predicts?
Usually that one of the inputs is wrong, for example the latency measured at the server misses time requests spend queued before reaching it, or the system is not stable and a queue is growing. A growing queue is a sign that arrivals exceed capacity and latency will keep rising until something gives.
7Conclusion
In this answer, we saw that Little's law, concurrency equals arrival rate times time in system, gives 400 x 0.15 = 60 concurrent requests and 400 x 0.05 = 20 database connections on average for our service. Read backwards, it tells us the throughput a pool can support. Because traffic and latency vary, we size threads and pools above the average, plan headroom from percentiles, and remember that the per-pod pool multiplied by the number of pods must fit what the database can handle.
Open with
Little's law says the average number of requests in a system equals the arrival rate times the average time each one spends there. So at 400 requests per second and 150 milliseconds average latency, that is 400 times 0.15, which is 60 requests in progress on average.
Then, if they want more
On Tomcat with platform threads that means about 60 busy worker threads, so the default of 200 is fine on average. The same law works for any resource if I use the time the resource is held. If each request holds a database connection for 50 milliseconds, the average need is 400 times 0.05, which is 20 connections.
It also works backwards: HikariCP's default of 10 connections at 50 milliseconds each can serve at most 200 requests per second, so we would queue. But I would never size to the average. Traffic bursts, and latency spikes during GC pauses or slow queries, and when a pool runs near full, queues build quickly.
So I plan with percentiles, for example peak rate times p99 hold time, plus some headroom, and I size per pod, remembering that six pods means six pools hitting the same database.
If that total is more than the database can handle, the answer is to shorten how long connections are held or add caching, not just raise the pool size.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Kubernetes documentation, Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Use Little's law to estimate how many concurrent requests a Spring Boot service handles...": https://scrivio-interview-library.netlify.app/spring-boot/production-operations/7f1d2a0749/