The idea: same servers, different lines
You have two servers, each able to serve 10 customers per second, and 18 customers per second arrive. Every way of arranging them is 90 % busy. Yet how long people wait depends a lot on the arrangement. The canvas runs three of them side by side with the very same customers:
- A, separate queues: each server has its own line, and each arrival picks a line at random. That is c separate M/M/1 queues, each getting λ/c = 9 per second.
- B, one shared queue: one line in front of all c servers. The first person in line takes whichever server frees up. This is the M/M/c queue.
- C, one fast server: a single M/M/1 server c times as fast, 20 per second.
Each customer brings the same amount of work to all three systems: a server at 10/s needs w/10 seconds for it, the fast server w/20. Three seeded random generators (arrival gaps, work, lane choice) make every run repeat exactly, and using the same customers everywhere means the differences come from the design, not from luck. The single-server formulas these rows build on are on the M/M/1 queue page. Demo: watch the first 8 customers follows each customer through all three rows.
Why separate lines lose
With separate lines a customer can stand in a line while the other server has nothing to do. In the first 8 customers it happens twice. At t = 0.168 s C4 picks lane 2 and waits behind the long job of C3 while server 1 is idle; in B it walks straight to server 2. At t = 0.318 s server 1 in A goes idle again while C4 and C6 still wait in lane 2. A shared line never lets a server idle while anyone waits; that is the whole trick of pooling.
The numbers after 100 000 customers at λ = 18/s (Demo: 100 000 customers):
| System | P(wait) run / formula | Wq run / formula | W run / formula |
|---|---|---|---|
| A, 2 × M/M/1 | 0.901 / 0.900 | 0.945 s / 0.900 s | 1.045 s / 1.000 s |
| B, M/M/2 | 0.856 / 0.853 | 0.415 s / 0.426 s | 0.515 s / 0.526 s |
| C, M/M/1 at 20/s | 0.902 / 0.900 | 0.438 s / 0.450 s | 0.488 s / 0.500 s |
Erlang C: the chance of waiting
For M/M/c, let a = λ/μ be the offered load in "servers' worth" of work (a = 1.8 here) and ρ = a/c the utilisation. An arrival waits only when all c servers are busy. The probability of that is the Erlang C formula, from the same kind of birth–death chain as M/M/1, except that the departure rate is nμ while n < c servers are busy:
(aᶜ / c!) · c / (c − a)
C(c, a) = ─────────────────────────────────────────
Σ (k = 0 … c−1) aᵏ / k! + (aᶜ / c!) · c / (c − a)
Wq = C(c, a) / (cμ − λ) W = Wq + 1/μ Little: Lq = λ Wq
c = 2, a = 1.8: C = 16.2 / (1 + 1.8 + 16.2) = 0.853 Wq = 0.853 / (20 − 18) = 0.426 s
For one server, C(1, a) = ρ, and the formula turns back into the M/M/1 one. Note what pooling does: P(wait) only drops from 0.9 to 0.853, but a customer who does wait leaves sooner, because any of the c servers can take them. The mean wait of those who wait is 1/(cμ − λ) = 0.5 s in B and 1/(μ − λ/c) = 1 s in A.
One fast server or many slow ones
C waits a little longer than B (Wq 0.45 s vs 0.426 s): it has only one server, so a customer waits whenever anyone is in service. But its service is twice as fast, so its total time W is shorter: 0.5 s vs 0.526 s. At light load the gap is wide. At ρ = 0.5 (Demo: light load) the run gives W = 0.099 s for C, 0.133 s for B and 0.202 s for A: hardly anyone waits, so the service time decides. A pool of slow servers only catches up when the load is high and waiting dominates. That is why one fast CPU core beats two slow ones for a single stream of work, when the work can use it.
| Load (c = 2) | W formula: A | B | C | W run: A / B / C |
|---|---|---|---|---|
| ρ = 0.5, λ = 10/s | 0.200 s | 0.133 s | 0.100 s | 0.202 / 0.133 / 0.099 s |
| ρ = 0.8, λ = 16/s | 0.500 s | 0.278 s | 0.250 s | 0.520 / 0.275 / 0.247 s |
| ρ = 0.9, λ = 18/s | 1.000 s | 0.526 s | 0.500 s | 1.045 / 0.515 / 0.488 s |
Demo: sweep ρ = 0.5, 0.8, 0.9 puts all three runs on the W vs ρ chart, on top of the three curves. The runs differ from the formulas by a few percent; how far a run of a given length can be trusted is the topic of Simulation Output Analysis.
A bigger pool gains more
With c = 4 servers and λ = 36/s (Demo: c = 4) the load is still ρ = 0.9. Four separate lines are four M/M/1 queues at λ = 9/s each, so A waits just as long as before: 0.942 s in the run. The shared queue of four waits 0.192 s (Erlang C: P(wait) = 0.788, Wq = 0.197 s), less than half its c = 2 value. The fast server at 40/s gets W = 0.244 s against 0.292 s for B.
Square-root staffing
Turn the question around: how many servers do you need so that at most 20 % of customers wait? Searching c with Erlang C gives the exact answer. The square-root staffing rule gives it in one line:
c ≈ a + β · √a β depends only on the target: P(wait) ≈ 1 / (1 + β Φ(β) / φ(β))
target P(wait) = 0.2 → β = 1.06 (Φ, φ: the standard normal CDF and density; Halfin–Whitt)
| Offered load a | Fewest c (Erlang C) | ⌈a + 1.06 √a⌉ | ρ = a/c | P(wait) |
|---|---|---|---|---|
| 2 | 4 | 4 | 0.50 | 0.174 |
| 8 | 12 | 12 | 0.67 | 0.140 |
| 32 | 39 | 39 | 0.82 | 0.166 |
| 128 | 141 | 141 | 0.91 | 0.182 |
The spare capacity c − a grows like √a, not like a (Demo: square-root staffing). Sixteen small call centres with a = 8 need 16 × 12 = 192 agents; one merged centre with a = 128 needs 141. It is the same economy of scale as in the rows above.
Two readings: supermarket lanes and thread pools
Supermarket lanes are design A: you pick a till and hope. Banks and airport desks with one snake line are design B. People can switch lanes, which helps A a little, but a single line is still better, and it is also fairer: nobody is overtaken by a luckier lane.
Thread pools face the same choice. A pool with one shared work queue (Java's
ThreadPoolExecutor with one BlockingQueue) is design B: any idle thread takes
the next task. Giving each thread its own queue is design A unless idle threads may steal work from
busy ones, which is what work-stealing pools do. Thread Pool shows the
pool itself, and Latency vs Throughput how its queue grows near
full load.
See also Discrete-Event Simulation (the general event list behind runs like these), Mean Value Analysis (several queues in a network) and 2k factorial design (measuring the effect of factors such as c and ρ with few runs).
What the page leaves out
The page splits arrivals in A at random. Round-robin or "join the shortest line" does better than random, but still worse than one shared line. It keeps every line unlimited (no M/M/c/K and no Erlang B for lost calls), every customer patient (no abandonment, the Erlang A model) and every server identical. It does not show switching costs between lanes, priorities, or service times that are not exponential. The square-root rule is an approximation for large a; the table shows it matches the exact search here, but it can be off by one server for other targets.