The Mathematics of Queueing: Why Your Grocery Line Is Always Slowest

You are at the grocery store. Five checkout lanes are open. You pick the shortest one. Within thirty seconds, the person in front of you produces a coupon that requires a manager. The lane next to you

You are at the grocery store. Five checkout lanes are open. You pick the shortest one. Within thirty seconds, the person in front of you produces a coupon that requires a manager. The lane next to you, which had three more people when you chose yours, is now empty.

This is not bad luck. This is mathematics.

Agner Krarup Erlang and the Telephone

Queueing theory was born in 1909 when Agner Krarup Erlang, a Danish mathematician working for the Copenhagen Telephone Company, tried to figure out how many phone lines a city needed. Too few, and callers got busy signals. Too many, and the company wasted money on idle infrastructure.

Erlang discovered that the mathematics of waiting have counterintuitive properties. The relationship between utilization and wait time is not linear — it is exponential. A system running at 50% capacity has short waits. At 80%, waits are noticeable. At 90%, they are painful. At 95%, the system effectively grinds to a halt. This is the Erlang delay formula, and it governs everything from call centers to web servers to hospital emergency rooms.

Why Your Line Is Always Slowest

When you choose the shortest line at the grocery store, you are making a rational decision with incomplete information. You can see the number of people in each line, but you cannot see the complexity of their transactions. One person with 30 items moves faster than three people who each need price checks, produce lookups, and split payments.

But the deeper reason is statistical. If five lines are open and one of them is slowest, there is only a 20% chance you picked the fastest one and an 80% chance at least one other line is faster. You notice when your line is slow because the frustration is salient. You do not notice the times your line was fastest because there is nothing to notice — you just leave.

This is a form of selection bias combined with loss aversion. Slow experiences weigh more heavily in memory than fast ones, so your subjective experience of grocery lines is systematically biased toward "mine was slowest."

Little's Law

In 1961, John Little proved an elegant theorem: the average number of items in a system (L) equals the average arrival rate (λ) multiplied by the average time each item spends in the system (W). In plain English: L = λW.

This seems obvious, but its power lies in what it implies. If you want to reduce the number of items in a system (queue length), you must either reduce arrivals or reduce processing time. There is no third option. No amount of clever queue management, lane switching, or priority schemes can violate Little's Law.

This is why "just add more servers" works in computing. You are reducing W (processing time per request), which reduces L (requests waiting) without changing λ (arrival rate). It is also why express lanes at grocery stores help: they route low-W transactions to dedicated servers, reducing average W across the system.

One Line vs. Many Lines

The single-queue, multiple-server model (like bank queues or airport security) is mathematically superior to the multiple-queue model (like grocery stores). With a single queue, no one gets stuck behind a slow transaction because the next available server takes the next person in line.

Wendy's figured this out in the 1990s and switched to a single queue. Banks followed. Airlines followed. The expected wait time decreases, variance decreases, and perceived fairness increases. The only reason grocery stores have not switched is physical layout — a single serpentine queue for an entire store would stretch back to the dairy section.

The Software Connection

Every web server, database connection pool, and API rate limiter is a queueing system. The math is identical. Erlang's formulas work for HTTP requests exactly as they work for telephone calls. This is why monitoring response times is critical for API products like CronPing and DocuMint — a sudden increase in response time is often the first sign that utilization is approaching the exponential knee of the curve.

The lesson from queueing theory is humbling: your intuition about waiting is systematically wrong. The mathematics are clear, counterintuitive, and inescapable. The next time your grocery line stalls, take comfort in the knowledge that Erlang predicted this in 1909.