Watching and Agreeing on State

Lesson 4 of 4

Measure the Wait Before the Load

Estimated time: 10 minutes

Measure the wait before you blame the load

A slow system invites the guess that it is simply busy. Sometimes it is, and adding capacity helps. Other times the delay comes from a task holding something another task needs, and more capacity only adds more tasks waiting.

Ask where the time actually goes

Record how long a request waits for each resource it needs, not only how long the whole request took. The resource that eats the time is the one to fix, and it is rarely the one that looks busiest.

Separate waiting from working

Time spent waiting on a shared resource and time spent doing work look the same in a single duration. Split them, and a queueing problem is told apart from a true capacity problem.

def split(waited, worked):
    return {"waited": waited, "worked": worked}

Add capacity only after the split

If the time is in waiting, more capacity does not help. If it is in work, it does. Measure first, then choose, so the fix matches the cause.