The Bill Arrives as Latency
Last timeThe Part Only One May Enter
Waiting at a lock does not grow smoothly with load. It is flat for a long time and then rises without limit, and the first thing to break is the slowest few per cent of requests.
A lock is correct. The question in this lesson is what it costs, and the answer
is more interesting than a constant. The cost of waiting is not proportional to
load. It is flat, and flat, and flat, and then it is not.
One number predicts the waiting
Take the rate at which workers arrive at the door and multiply it by how long one
trip through the door takes. The product is the share of time the region is
occupied, and almost everything else follows from it.
| step | share of time the door is occupied | share of it still free | the multiplier, occupied over free | average wait | against the first row | what happened |
|---|---|---|---|---|---|---|
| 1 | 60 per cent | 40 per cent | 0.6 over 0.4, so 1.5 | 40 times 1.5, so 60 microseconds | 1 time | A year of running like this with nothing to report. An arrival waits one and a half holds on average, which is a figure nobody has ever been paged about. |
| 2 | 72 per cent | 28 per cent | 0.72 over 0.28, so 2.57 | 40 times 2.57, so 103 microseconds | 1.7 times | Twenty per cent more traffic, which is 60 times 1.2. Occupancy rose by twelve points and the wait rose by seventy per cent, because those twelve points came out of the free share sitting underneath the division. |
| 3 | 86.4 per cent | 13.6 per cent | 0.864 over 0.136, so 6.35 | 40 times 6.35, so 254 microseconds | 4.2 times | The same twenty per cent again, which is 72 times 1.2. It adds a similar 14.4 points and costs two and a half times the wait, because this time those points were more than half of everything still free. |
That is the pattern which otherwise looks like bad luck. Nothing was deployed
between the first row and the last. No component failed. Traffic grew by a fifth
and then by a fifth again, which is the most ordinary thing that can happen to a
system, and the curve simply got steep underneath it.
The lesson stops here
6 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents