A blog post about queueing theory that I wrote back in 2008 continues to be popular. The post shows that when a system is close to capacity, adding another server dramatically reduces the wait time. In that example, going from one teller to two tellers doesn’t make service twice as fast but 93 times as fast.

That post starts out at a very high level and then goes into some details. This post goes into much more detail.

For a quick introduction to queueing theory, see this page.

## Queueing theory notation

In Kendall’s notation, we’re talking about *M*/*M*/1 and *M*/*M*/2 queues. The first letter denotes the assumed distribution on times between customer arrivals, the second denotes the distribution on service times, and the number at the end gives the number of servers.

The simplest and most common models in queueing theory are *M*/*M* models. The *M*‘s stand for “Markov” but they really mean exponential. (Sorry. I didn’t invent the notation.) The time between arrivals is exponentially distributed, which means the arrival is a Poisson process. The time it takes to serve each customer is also exponentially distributed.

Let λ be the number of who arrive per unit time, and let μ be the number of customers served per unit time, on average. For the system to approach a steady state we must have λ/μ < 1. Otherwise the number of customers in the queue grows over time without bound. In the example I mentioned above, λ = 5.8 customers per hour, and μ = 6 customers per hour. Customers are coming in nearly as fast as they can be served, and so a long line develops.

## M/M/1 equations

For a *M*/*M*/1 queue, the expected wait time, once the system reaches steady state, is

and the expected number of customers waiting at any time is

## M/M/2 equations

The equations for *M*/*M*/*k* systems in general are significantly more complicated, but they’re not bad when *k* = 2. For an *M*/*M*/2 system at steady state, the expected wait time is

and the expected number of customers waiting is

You may have noticed that for both *M*/*M*/1 and *M*/*M*/2 the expected number of customers waiting in line is λ times the expected wait time, i.e. *L* = λ*W*. This is true in general and is known as Little’s law.

Next to John’s nice material on queueing, it is amusing to read Robert Matthew’s note Ladies in waiting, New Scientist, 167, July 29, 2000.