12342 waitingidle
Envelopes: requests from the clientsYellow tray: the shared line; the head (next out) is on the rightGreen blocks: servers (cores or agents); an envelope on top is being servedMeter: utilisation, chance of waiting (Erlang C) and mean waitRequests arrive at random, 320 a second, and each takes 10 ms of a server's time on average: 3.2 erlangs of traffic on 4 servers, each 80% busy. With one shared line the Erlang C formula says 59.6% of requests wait, 7.46 ms on average; with four separate lines 80% wait, 40.0 ms on average. The 320 requests a second, 10 ms per request and the 64 calls an hour of 3 minutes are illustrative, chosen to give 3.2 erlangs; every other number follows from the M/M/c formulas. M/M/c assumes random (Poisson) arrivals and exponential service times. Real traffic is often burstier, which makes waits longer, but the pooling effect still holds.

Servers and erlangs

  1. Requests reach a web server with four cores at random moments, about 320 a second. A core takes 10 ms per request on average. All four share one line. This is an M/M/4 queue: random arrivals, random service times, 4 servers.

Erlang C

Pooling

The arithmetic

;; step 1/10 · many-servers · arrive
;; clients → shared queue
Kendall's notation  M / M / c
  M  arrivals are memoryless: a Poisson process
  M  service times are memoryless: exponential
  c  servers sharing one line; here c = 4
arrival rate   λ = 320 per second
service rate   μ = 1 / 10 ms = 100 per second per core

The figure shows a few requests at a time; the meter gives the long-run averages. The separate lines take requests at random. Sending each request to the shortest line helps, but it still loses to one shared line, because a request cannot switch to a core that frees up later.