Learn
Lesson · Queues and Utilisation · The M/M/1 model

The M/M/1 Queue

One server, memoryless arrivals at λ, memoryless service at μ, room for everyone. Balancing the flow across the cut between n and n + 1 gives λπₙ = μπₙ₊₁, so the states decay geometrically and every quantity the course needs — L, L_q, W, W_q and P(N > k) — follows from a geometric series.

λπₙ = μπₙ₊₁ balance across the cut between n and n+1 πₙ = (1 − ρ)ρⁿ so the states decay geometrically L = ρ/(1 − ρ) L_q = ρ²/(1 − ρ) L − L_q = ρ W = L/λ = S/(1 − ρ) with S = 1/μ, by Little's Law P(N > k) = ρ^(k+1) the tail, exactly
One balance equation, and everything that follows from it

Core ideas

What this lesson establishes

The derivation is three lines and a geometric series. What takes care is knowing which system it describes and which it does not.

1

Balance across a cut, not a theory of chains

Draw a line between the states with n in the system and those with n + 1. In the long run the system crosses that line upward exactly as often as downward, so λπₙ = μπₙ₊₁. That single conservation statement, applied at every n, determines the whole distribution.

2

Everything else is the geometric series

πₙ = ρⁿπ₀ follows immediately, and the probabilities must sum to one, so π₀ = 1 − ρ by Algebra's infinite-geometric-series — which also needs ρ < 1, and that is the same condition as the queue settling at all. The mean L = Σ nπₙ is the same series differentiated.

3

L counts the one being served

L is the number in the system and L_q the number waiting, and the difference is not a rounding detail: L − L_q = ρ exactly, the probability that the server is busy. At ρ = 4/5 the system holds 4 on average and 16/5 of them are queueing.

The material

The cut, the distribution, and the four numbers that follow

The derivation, the worked arithmetic at ρ = 4/5, and a careful statement of what this formula is and is not checked against.

Definition · M/M/1

Arrivals are memoryless at rate λ; service times are memoryless with rate μ, so the mean service time is S = 1/μ; there is one server, unlimited room, and customers are taken in order. N is the number in the system, including the one in service, and πₙ = P(N = n) in the long run. The model settles precisely when ρ = λ/μ < 1.

The notation S = 1/μ is fixed here and used by the rest of this path: it is the mean service time, the thing a trace measures directly, and writing the results in terms of it is what makes the knee legible in the next lesson.

Theorem · The stationary distribution

For ρ = λ/μ < 1, πₙ = (1 − ρ)ρⁿ for every n ≥ 0.

Consider the boundary between {0, 1, …, n} and {n + 1, n + 2, …}. Every crossing upward is an arrival that happens while the system holds n, at rate λπₙ; every crossing downward is a completion while it holds n + 1, at rate μπₙ₊₁. In the long run the two counts differ by at most one, so the rates are equal: λπₙ = μπₙ₊₁.

Therefore πₙ₊₁ = ρπₙ, and by induction πₙ = ρⁿπ₀. The probabilities sum to one, so π₀ Σ ρⁿ = 1; the series converges exactly when ρ < 1, to 1/(1 − ρ), giving π₀ = 1 − ρ and πₙ = (1 − ρ)ρⁿ.

The mean is L = Σ nπₙ = (1 − ρ) Σ nρⁿ = (1 − ρ)·ρ/(1 − ρ)² = ρ/(1 − ρ), using the same geometric sum in its Σ nrⁿ = r/(1 − r)² form.

□

The tail falls out of the same geometric shape: P(N > k) = ρ^(k+1), because being above k means the chain climbed k + 1 steps each costing a factor ρ. L_q is L minus the one in service, L − ρ, which rearranges to ρ²/(1 − ρ). And W comes from Little's Law rather than from any new argument: W = L/λ, which simplifies to 1/(μ − λ) and hence to S/(1 − ρ).

λ = 4/5 per second μ = 1 per second S = 1/μ = 1 s ρ = λ/μ = 4/5 π₀ = 1 − ρ = 1/5 π₂ = (1 − ρ)ρ² = (1/5)(16/25) = 16/125 L = ρ/(1 − ρ) = (4/5)/(1/5) = 4 L_q = ρ²/(1 − ρ) = (16/25)/(1/5) = 16/5 L − L_q = 4 − 16/5 = 4/5 = ρ the one in service W = L/λ = 4 ÷ 4/5 = 5 s = S/(1 − ρ) W_q = L_q/λ = (16/5) ÷ (4/5) = 4 s = W − S P(N > 3) = ρ⁴ = 256/625 ≈ 0.4096

Every one of those is an exact fraction, and the two checks in the middle are free: L − L_q must be ρ, and W − W_q must be S. If either fails, an arithmetic slip has happened rather than a modelling one.

What this formula is not checked against

It is tempting to say the slotted simulation of “Why Queues Form at ρ < 1” confirms these closed forms. It does not, and the claim would be false. That simulation is a discrete-time chain: Bernoulli arrivals with probability p per slot, geometric service with parameter q, late arrivals. At p = 2/5 and q = 1/2 its server utilisation is p/q = 4/5, exactly as it should be, and its exact mean number in system is 12/5. ρ/(1 − ρ) at ρ = 4/5 is 4. The continuous formula overstates that system by a factor of 5/3.

The relation between the two is a limit, not an agreement. Hold λ and μ fixed and let the slot Δ shrink with p = λΔ and q = μΔ: the discrete chain's mean climbs toward ρ/(1 − ρ), and the gap closes in proportion to Δ.

λ = 4/5, μ = 1, so ρ = 4/5 and ρ/(1 − ρ) = 4 Δ = 1 p = 4/5, q = 1 exact mean 4/5 gap 16/5 Δ = 1/10 p = 2/25, q = 1/10 exact mean 92/25 gap 8/25 Δ = 1/100 p = 1/125, q = 1/100 exact mean 496/125 gap 4/125 each gap is exactly a tenth of the one above it: linear in Δ

The lab prints that sequence beside the closed form rather than claiming a single slot size agrees with it. The exact finite-slot answer at each step is Operations Research's, markov-chains-decisions-and-queues/queues-in-discrete-time; what is shown here is that it converges to this lesson's formula and how fast.

The same reconciliation runs the other way. The balance argument above is the steady state of a birth–death chain, and Operations Research builds that chain properly in markov-chains-decisions-and-queues/poisson-arrivals-and-the-mm1-queue, recovering this distribution as its continuous-time limit. System Design owns the closed forms — this lesson is the library's reference for L, L_q, W, W_q and P(N > k) — and nothing in the two treatments contradicts the other.

Four assumptions are doing the work, and the rest of this course takes each of them away in turn: memorylessness (“Variability: the Kingman Approximation” prices getting it wrong), the single server (“Many Servers: Pooling, and Erlang C”), the unlimited room (“Bounded Queues and Loss”), and the steady state itself (“Transient Overload and Draining the Backlog”).

Interactive

The M/M/1 queue

Flow balance across a cut, and the shrinking slot that reaches it

The M/M/1 queueπn = (1 − ρ)ρn, and everything that follows from it
πnin servicewaitingthe slotted chain

Method

Computing an M/M/1 queue

Get ρ first. Every other quantity is a function of it alone.

1

Compute ρ = λ/μ and check it is below one

Above one there is no stationary distribution to compute, and the formulas return negative numbers rather than refusing. S = 1/μ is worth writing down at the same time.

2

Read off the distribution

π₀ = 1 − ρ and πₙ = (1 − ρ)ρⁿ. The tail P(N > k) = ρ^(k+1) needs no sum: it is one power.

3

Take L, then get L_q by subtracting ρ

L = ρ/(1 − ρ), and L_q = L − ρ. Doing it in that order makes the relationship between the two visible and gives a free check.

4

Convert to times with Little's Law

W = L/λ and W_q = L_q/λ. Check that W − W_q = S; if it does not, the arithmetic went wrong rather than the model.

5

Say which assumption you are least sure of

Poisson arrivals, exponential service, one server, unlimited room. Naming the weakest one is what turns a computed number into an estimate with a direction of error.

The closed forms

Score 0 / 0

An M/M/1 queue at λ = 4/5, μ = 1

A service taking one second on average, offered work four fifths as fast as it can do it. Every figure below is exact.

λ = 4/5 / s μ = 1 / s S = 1/μ = 1 s ρ = 4/5 π₀ = 1 − ρ = 1/5 idle a fifth of the time π₂ = (1/5)(4/5)² = 16/125 L = (4/5)/(1/5) = 4 in the system L_q = L − ρ = 4 − 4/5 = 16/5 waiting W = L/λ = 4 ÷ (4/5) = 5 s W_q = L_q/λ = (16/5) ÷ (4/5) = 4 s check W − W_q = 1 s = S ✓ P(N > 3) = ρ⁴ = 256/625 ≈ 0.4096

Read the last two lines together. The server takes one second over a request, and a request spends five seconds in the system: four of those five seconds are spent waiting behind other people, at a utilisation most capacity plans would call comfortable.

And there is a 41% chance of finding four or more in the system. The mean of 4 is not a typical value in any useful sense — the distribution is geometric, so it has no characteristic scale below its tail.

For a faded rehearsal, take λ = 9/10 with μ = 1. The supplied first move is ρ = 9/10, so π₀ = 1/10. Predict L, W and P(N > 3) before computing them, and notice how much moved for one tenth of extra load.

Common mistakes

1
Reading L as the number waitingL counts everyone in the system, including whoever is being served. The waiting number is L_q = ρ²/(1 − ρ), and the two differ by exactly ρ. Quoting L as a queue depth overstates it by the better part of a customer at high utilisation and by nearly all of it at low.
2
Saying this formula is checked against the slotted simulationIt is not, and it must not be: the slotted system is a Geo/Geo/1 chain whose exact mean at p = 2/5, q = 1/2 is 12/5, against 4 from ρ/(1 − ρ). The relationship is a limit as the slot shrinks — gaps of 16/5, 8/25, 4/125 at Δ = 1, 1/10, 1/100 — and stating it as a check would be stating something false.
3
Applying it to a service whose variability is not exponentialThe Ms are assumptions with a price. A service with very regular service times waits about half what this formula says, and one with a heavy tail waits considerably more. “Variability: the Kingman Approximation” puts a number on that, and the right habit here is to name the assumption whenever the result is quoted.

Check your understanding

✓
Finish when the whole distribution comes out of one balance equation and a geometric series.

You should be able to derive πₙ = (1 − ρ)ρⁿ from the cut, compute L, L_q, W, W_q and P(N > k) as exact fractions at a rational ρ, and state precisely why the slotted chain of “Why Queues Form at ρ < 1” does not produce ρ/(1 − ρ) at a finite slot size.

Note: One rearrangement of W = L/λ is the most useful sentence on this course. “The Knee: Response Time vs Utilisation” reads it as W = S/(1 − ρ) — a hyperbola with an asymptote at ρ = 1 — and that curve is why every capacity plan on this path names a target utilisation instead of a maximum one.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.