FREE LESSON · Networks & distributed systems · 9 OF 13
Queueing, utilization, and Little’s law
Queueing, utilization, and Little’s law: Use consistent units and system boundaries to reason about latency and overload.
Prerequisites: Rates, averages, probability basics, and request-response systems.
Learning objectives
- Apply L=λW with a clearly defined boundary.
- Separate service time from waiting time.
- Explain why capacity near saturation produces fragile latency.
A queueing model defines a boundary around work entering, waiting, receiving service, and leaving a system. Let L be the long-run average number of jobs inside that boundary, λ the effective arrival rate of jobs entering it, and W their average time inside it. Under the appropriate stable long-run conditions, Little's law gives L=λW. The relationship does not require exponential service times or a particular scheduling order, but the quantities must refer to the same population and boundary.
Suppose a service completes 200 requests per second in steady state, and the average end-to-end time inside the measured service is 0.15 seconds. The average number of requests in flight is 200×0.15=30. If only waiting time is 0.10 seconds, then the queue contains an average of 20 waiting requests, while the remaining average 10 are in service. Mixing queue-only L with whole-system W produces an incorrect calculation.
Arrival rate must account for admission. If a gateway receives 1000 requests per second but rejects 400 before the service boundary, the service's effective input rate is 600, not 1000. Retries may represent additional attempts, so distinguish attempts from unique business operations. A system with an ever-growing backlog does not have the stable finite averages assumed by the simplest steady-state calculation.
Utilization measures how much service capacity is occupied. A single server requiring an average of 5 milliseconds per job has nominal capacity 200 jobs per second. At arrival rate 180, utilization is 0.9 under a simple work-conserving model. This leaves little spare capacity to absorb variability. Mean service time alone does not determine mean waiting time; arrival bursts, service-time variance, parallelism, and scheduling all matter.
For the specifically assumed M/M/1 model, arrivals are Poisson, service times are exponential, one server works first-come-first-served, and λ<μ. Mean time in the system is 1/(μ−λ). With μ=200 and λ=180, W=0.05 seconds. At λ=198, W=0.5 seconds. A ten-percent change in offered rate can therefore coincide with a tenfold latency increase near saturation in this model. These values are not a universal prediction for every production service.
Queue limits, admission control, backpressure, deadlines, and cancellation change how overload is handled. Unbounded queues can convert temporary overload into stale work and memory exhaustion. Blind retries add load precisely when capacity is scarce. A deadline should cover the whole request budget rather than restarting indefinitely at each hop.
Measure distributions as well as means. Two systems with the same average latency can have different tail behavior. Use Little's law as a consistency check and capacity accounting tool, then validate a more detailed model against measured arrivals, concurrency, queue length, and completion times.
Practice problem
A stable worker pool admits 120 jobs per second. Mean total time in the pool is 250 milliseconds, including 150 milliseconds waiting. Compute average jobs in the system, waiting, and being serviced. The gateway sees 150 attempts per second and rejects 30 before admission. Explain which arrival rate belongs in each calculation. Then use the stated M/M/1 formula with μ=100 and λ=80, followed by λ=95, and explain its assumptions.
Worked solution
Use 120 admitted jobs per second for the worker-pool boundary. Total occupancy is 120×0.25=30 jobs; waiting occupancy is 120×0.15=18; average in service is 12. The 150 gateway attempts belong to a different boundary that includes rejected work, so substituting 150 into the pool calculation mixes populations. Under M/M/1, total mean time is 1/(100−80)=0.05 seconds and then 1/(100−95)=0.2 seconds. Those results require the model’s Poisson arrivals, exponential service, single server, and stability assumptions. The pool itself may have multiple workers and another service distribution, so the formula is an illustration, not a justified prediction of its latency.
Check your understanding
A stable pool admits 80 requests per second, with mean total residence 0.2 seconds and mean waiting 0.15 seconds. What are total and waiting occupancy?
- 400 and 533
- 12 and 16
- 16 and 12
- 80 and 60
Explanation
Use the same admitted rate:80×0.2=16 total, and 80×0.15=12 waiting.
A gateway receives 150 attempts per second but rejects 30 before the worker-pool boundary. Pool residence averages 0.25 seconds. Which occupancy follows from Little’s law?
- 37.5 using every gateway attempt.
- 480 by dividing arrivals by residence time.
- 7.5 using only rejected jobs.
- 30 using 120 admitted jobs per second.
Explanation
The pool boundary includes admitted jobs only, giving 120×0.25=30.