Basis Lab

Doing Two Things at Once

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.

FIG 1Twenty per cent more traffic, twice, with a forty microsecond hold
stepshare of time the door is occupiedshare of it still freethe multiplier, occupied over freeaverage waitagainst the first rowwhat happened
160 per cent40 per cent0.6 over 0.4, so 1.540 times 1.5, so 60 microseconds1 timeA 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.
272 per cent28 per cent0.72 over 0.28, so 2.5740 times 2.57, so 103 microseconds1.7 timesTwenty 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.
386.4 per cent13.6 per cent0.864 over 0.136, so 6.3540 times 6.35, so 254 microseconds4.2 timesThe 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.
3 steps
The second column is the one doing the damage, because it is what the hold gets divided by. Each twenty per cent of extra traffic takes a dozen or so points out of it, which is under a third of it in the first row and over half of what remains in the second, so the same ordinary growth costs 1.7 times the wait once and then 2.5 times the wait again. Carry the last row further and it keeps going the same way: a door that is 99 per cent occupied has 1 per cent free, a multiplier of 99, and a wait of 40 times 99, which is 3,960 microseconds for a trip that takes forty.
FIG 2Waiting against how busy the door is
0.00250.00500.00750.001000.000.00.20.50.70.9share of time the guarded region is occupied
a forty microsecond holdan eight hundred nanosecond hold
Both curves have the same shape, which is the point. Shortening the hold moves the whole curve down but does not change where the wall is, and the wall is always at full occupancy regardless of how fast the guarded region is.

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 contents

This 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

The rest of this course

  1. 01The Update That Vanished
  2. 02A Door That Admits Oneopening only
  3. 03The Bill Arrives as Latencyyou are here
  4. 04Everybody Holding, Nobody Movingopening only
  5. 05Try, Check, Try Againopening only
  6. 06The Promise Is Weaker Than You Thinkopening only
  7. 07The Ceiling You Cannot Buyopening only
  8. 08The Problem You Decide Not to Haveopening only

Read alongside