The M/M/1 Queue and Waiting-Time Distributions
A single-server queue with random arrivals and random service times has a wait time that doesn't grow smoothly as the server gets busier — it blows up, and the M/M/1 model is the cleanest way to see exactly how.
Prerequisites: Queueing Theory and Birth-Death Processes, Little's Law
Picture a single checkout line at a small grocery store. Customers arrive at random, unpredictable moments. The cashier serves each one in a random amount of time — some transactions are quick, some take forever because someone can't find their card. If you asked "how long will the average customer wait," you might guess the answer depends smoothly and gently on how busy the store is. It doesn't. A store running at 50% of its checkout capacity has short lines. A store running at 95% of capacity — seemingly "almost fine" — has customers waiting an order of magnitude longer, not because anything catastrophic happened, but because randomness compounds violently as a system approaches full utilization. The M/M/1 queue is the simplest mathematical model that makes this blowup precise, and it shows up everywhere a resource serves random requests one at a time: an exchange's matching engine, a market maker's quote-update pipeline, a single execution algorithm working one order at a time.
The setup, one symbol at a time
"M/M/1" names three things about the queue. The first M means arrivals happen according to a Poisson process with rate ("lambda") — customers (or orders, or requests) arrive one at a time, at random moments, with events happening per unit time on average, and the gaps between arrivals are memoryless (exponentially distributed). The second M means service times are also exponentially distributed, with rate ("mu") — the server finishes an average of customers per unit time it's working, and like the arrivals, how long the current customer has already been served tells you nothing about how much longer they'll take. The 1 means there is exactly one server.
The single most important derived quantity is the utilization, or traffic intensity:
In words: utilization is the ratio of how fast work arrives to how fast the server can do it. If , the server can keep up on average and the queue reaches a stable, steady-state length. If , work arrives faster than it can be cleared and the queue grows without bound. Assuming , the steady-state formulas for an M/M/1 queue are:
is the expected number of customers in the system (waiting plus being served) once things have settled into steady state. is the expected total time a customer spends in the system, waiting plus being served. These two are tied together by Little's Law, — in words, the average number of items in a system equals the arrival rate times the average time each item spends there, a relationship that holds for essentially any stable queue, not just M/M/1.
Expected wait in an M/M/1 queue scales like , not like — it is nearly flat at low utilization and shoots toward infinity as utilization nears 100%. A system "90% as busy" as another can have a wait many times longer, not 90% as long.
Adjust the rate parameter in the explorer above and watch the shape of the Poisson distribution change — this is the distribution governing arrivals in an M/M/1 queue; the wait-time blowup in the figure above comes from the interaction between this arrival randomness and the server's own randomness, not from either one alone.
Worked example 1: a market maker's quote-update queue
Suppose a market maker's system receives quote-update requests at per second (Poisson) and its single processing thread handles requests at per second (exponential service time, average seconds each). Utilization is . Expected number of requests in the system: requests, on average, either waiting or being processed. Expected total time a request spends in the system: seconds. Check with Little's Law: — matches exactly.
Worked example 2: what happens as utilization creeps up
Keep fixed and raise from 5 to 9.5, watching :
- : , seconds.
- : , seconds — 2.5x the wait at , even though only rose by 60% relative.
- : , second — double again.
- : , seconds — double again, from a 5-percentage-point rise in .
Utilization went from 0.5 to 0.95 — less than double — while wait time went from 0.20 to 2.00 seconds, a tenfold increase. That is the shape: nothing catastrophic happens to itself, but , the thing in the denominator, is shrinking toward zero, and dividing by a number approaching zero is what produces the blowup.
What this means in practice
- Capacity planning near "busy but fine" is dangerous. A system running comfortably at that grows its load to hasn't gotten "somewhat slower" — its wait time has likely tripled or more. Sizing infrastructure with headroom well below isn't conservatism, it's the only way to keep tail latency bounded.
- The waiting-time distribution, not just its average, is exponential with rate — meaning wait times are themselves highly variable, and occasional very long waits are expected even when the average wait looks tame, which matters for latency-sensitive execution and matching-engine design.
- Single-server bottlenecks (the "1" in M/M/1) are the worst case. Splitting one busy queue into several parallel servers (an M/M/c queue) tends to reduce wait dramatically for the same total capacity, which is why systems add parallel processing threads rather than speeding up one thread.
- The Poisson/exponential assumptions are a deliberate simplification. Real arrival and service processes are rarely perfectly memoryless; when they're not, the more general M/G/1 (Pollaczek-Khinchine) or G/G/1 (Kingman) formulas are needed, but the qualitative blowup-near- behavior persists across all of them.
The classic confusion: assuming average wait time scales roughly linearly with utilization — "we're running 10% busier, so waits should be about 10% longer." They don't. Wait scales like , which is nearly flat for small and moderate and then diverges as . The relevant quantity to watch isn't itself but how close is to zero — that's the number that's actually driving the wait, and it can shrink dramatically from what looks like a modest increase in load.
Related concepts
Practice in interviews
Further reading
- Ross, Introduction to Probability Models (ch. 8, Queueing Theory)
- Kleinrock, Queueing Systems, Vol. 1