The Problem You Decide Not to Have
Last timeWhy More Workers Stop Helping
Every technique in this course manages a shared piece of state. The cheapest option is to arrange that nothing is shared, and to pay the costs that choice brings instead.
Seven lessons have been about managing a shared piece of state. This one is
about the move that makes the previous seven unnecessary, and about why it is not
free.
The observation behind it is simple. Every cost in this course, the waiting, the
cycles, the aborted attempts, the ceiling, arises from two workers wanting the
same thing. If no two workers ever want the same thing, none of those costs
exists. So the first question about a contended resource should not be which
technique to apply to it, but whether it needs to be shared at all.
One owner for each piece
The standard move is to split the state by some key and give each piece exactly
one owner. A request is routed to the owner of the key it concerns, and that
owner handles it alone.
The waiting is not abolished, it is converted. Instead of workers contending for
a lock, requests queue for an owner. That is a real improvement rather than a
relabelling, because a queue is a well behaved object. It has a visible length
you can alarm on, a bounded capacity, a first-in order, and no possibility of a
cycle, a lost wakeup or a priority inversion. The entire family of failures from
the middle of this course is designed out along with the sharing.
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