Learn
Lesson · Queues and Utilisation · Rates and Little's Law

Little's Law from a Trace

L = λW is not a model and not an approximation: it is one area counted two ways. Slice the graph of the number in system vertically and you get the time-average L; slice it horizontally and you get one bar per customer, whose total is n·W. The library proves it here, on a trace of five customers.

N(t) how many are in the system at time t L = area(N)/T the time-average number in system λ = n/T arrivals per unit time over the window W = Σ(dᵢ − aᵢ)/n the mean time one customer spends inside L = λW the same area, counted the other way round
Three averages over one window, and the identity between them

Core ideas

What this lesson establishes

The proof is a picture, and once the picture is seen the formula stops needing to be remembered.

1

The area under N(t) is the sum of the stays

Each customer adds exactly 1 to N(t) for exactly as long as it is in the system, and nothing to it otherwise. So the region under the staircase can be added in vertical strips — one per unit of time, height N(t) — or in horizontal bars, one per customer, length dᵢ − aᵢ. The two totals are the same number because they are the same region.

2

No distribution appears anywhere in it

There is no Poisson here, no memorylessness, no steady state, no service discipline and no independence. L = λW holds for one particular trace of five customers, for a queue served in reverse order, for a system that is not a queue at all. It is arithmetic about a window.

3

The window must be closed to be counted

The identity compares an area that has accrued with stays that have finished. If someone is still inside at time T, the area has counted time that no completed stay has counted yet, and the two sides differ — not because the law failed but because the measurement stopped early.

The material

One area, counted twice

The definitions, the proof, the arithmetic on a five-customer trace, and the one way to get it wrong.

Definition · The three averages over a window

Over a window [0, T] in which n customers arrive at times aᵢ and leave at times dᵢ: N(t) is the number present at time t; L is the time-average of N(t), the area under it divided by T; λ is n/T; and W is the mean of the sojourn times dᵢ − aᵢ.

Take five customers arriving at 0, 1, 2, 5, 6 and leaving at 3, 4, 6, 8, 10. Nothing is assumed about why they arrived when they did or how long they were served. This is a record, not a model.

t 0 1 2 3 4 5 6 7 8 9 N(t) 1 2 3 2 1 2 2 2 1 1 area = 17 stays 3 − 0 = 3 4 − 1 = 3 6 − 2 = 4 8 − 5 = 3 10 − 6 = 4 sum = 17

The two seventeens are not a coincidence and they are not a check that might have failed. They are the same area, added in two directions.

Theorem · Little's Law, on a closed window

If every customer who arrives in [0, T] has also departed by T, then L = λW exactly, where L, λ and W are as defined above.

Customer i contributes 1 to N(t) for t in [aᵢ, dᵢ) and 0 elsewhere, so the total area under N(t) is Σᵢ (dᵢ − aᵢ): adding the strips vertically and adding the bars horizontally are two orders of summation over the same finite set of unit cells.

Divide that equality by T. The left side is area/T = L. The right side is Σᵢ(dᵢ − aᵢ)/T, and multiplying and dividing by n makes it (n/T)·(Σᵢ(dᵢ − aᵢ)/n) = λW. No property of the arrival times or the service times was used, only that every stay lies inside the window.

□

On the trace above: L = 17/10, λ = 5/10 = 1/2, W = 17/5, and λW = (1/2)(17/5) = 17/10, which is L to the digit. The lab prints all three as exact fractions for whatever trace you type into it.

Where it appears to fail, and why that is never the law

Cut the same trace at T = 8, while the last customer is still inside. Now L = 15/8 = 1.875 and λW = (5/8)(13/4) = 65/32 = 2.03125. The two sides part company because λ counted five arrivals while W averaged the four stays that had finished. Extend the window to 10 and they agree again. Every report of “Little's Law not holding” on a real system is this: a measurement window with work still in flight, or three quantities measured at three different boundaries.

Example · A trace with no overlap at all

Arrivals at 0, 2, 4, 6, 8 and departures at 2, 4, 6, 8, 10: exactly one customer is present at every instant, so L = 1. With λ = 1/2 and W = 2, λW = 1. Here L is the fraction of time the system is occupied, which is the ρ of the previous lesson seen from this side.

What the identity does not give you is any information about the distribution of the waiting. W is a mean, and a mean says nothing about the p99 that Latency and the Tail measured. Two systems with identical L, λ and W can have entirely different tails.

The same counting argument works across any boundary you can draw, with λ the rate that crosses into it: a component, a thread pool, a whole datacentre. That generalisation is Operations Research, markov-chains-decisions-and-queues/littles-law, which cites this proof and carries the boundary version and the rule that the rate must be the one actually admitted — which is exactly what a lossy system later in this course will need.

Interactive

Little's Law, proved by counting

L = λW with no distribution in it anywhere

Little's Law on a tracethe area under N(t), and the sum of the times — the same number, counted twice
N(t)each customer's staystill in flight

Method

Verifying the identity on a trace you have been handed

Do this once by hand. It takes a minute and it is the difference between a formula and a fact.

1

Draw N(t) as a staircase

Step up at each arrival, down at each departure. On a slotted trace it is enough to write the count in each slot in a row.

2

Add the area by counting

Sum the heights. On a unit-slot trace that is a sum of whole numbers, and it is the left-hand side of the identity.

3

Add the stays one customer at a time

dᵢ − aᵢ for each, then total them. This is the same number, and getting a different one means a time was mis-transcribed.

4

Divide, and check

L = area/T, λ = n/T, W = total/n. Multiply λ by W and compare with L; as exact fractions they are equal, not close.

5

Say which window you used

L = λW is a statement about a window, so the window is part of the answer. If work was still in flight at the end, say so — that is the one condition the proof needed.

Counting the same area twice

Score 0 / 0

Five customers over ten slots, then the same trace cut short

The first column is the identity. The second is the only way to break it, done deliberately so that the break is recognisable later.

arrivals a = 0, 1, 2, 5, 6 departures d = 3, 4, 6, 8, 10 T = 10, n = 5 t 0 1 2 3 4 5 6 7 8 9 N(t) 1 2 3 2 1 2 2 2 1 1 area = 17 stays 3, 3, 4, 3, 4 sum = 17 L = 17/10 λ = 5/10 = 1/2 W = 17/5 λW = (1/2)(17/5) = 17/10 = L ✓ now stop the clock at T = 8, with one customer still inside area over [0,8] = 15 L = 15/8 = 1.875 arrivals 5, λ = 5/8; four stays done, W = 13/4 λW = (5/8)(13/4) = 65/32 = 2.03125 ✗

The second column did not break the law. It measured λ over five arrivals and W over four completions, which are two different populations, and the gap between 15/8 and 65/32 is exactly the stay that had not finished.

For a faded rehearsal, take arrivals 0, 1, 4 with departures 2, 5, 6. The supplied first move is that the horizon is T = 6 and every customer has left by it. Build the staircase, get the area both ways, and predict L before dividing anything.

Common mistakes

1
Believing the identity needs Poisson arrivalsIt is quoted so often beside M/M/1 that the two get welded together, and then a reader refuses to use it on a real system whose arrivals are obviously not Poisson. The proof above uses no property of the arrival process. If you can count arrivals and time stays, L = λW is available.
2
Measuring over a window with work still in flightCounting every arrival but only the completed stays gives λ a bigger population than W, and the identity fails by the amount still inside — 15/8 against 65/32 on the lesson's trace. Extend the window until it is closed, or count only the customers who both arrived and left inside it.
3
Measuring the three quantities at three different boundariesL inside a thread pool, λ at the load balancer and W from the client's stopwatch are three different systems, and their numbers have no reason to satisfy anything. Draw the boundary first, then count what crosses it and how long things stay inside it.

Check your understanding

✓
Finish when you would reach for L = λW on a system with no model at all.

You should be able to build N(t) from arrival and departure times, get the area by counting in either direction, produce L, λ and W as exact fractions, and diagnose a failed check as a window or a boundary problem rather than a broken law.

Note: The identity is most useful solved for something you do not know. “Sizing with Little’s Law” does exactly that: fix any two of the three and the third is determined, which is how a connection pool, a thread count and a throughput ceiling turn out to be one arithmetic problem.

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.