The token bucket is the rate limiter that behaves like a fluid. Capacity is the bucket size, the refill rate is the faucet, and each request is one token drained. This diagram walks one request through the decision: load the bucket, compute earned tokens from elapsed time, consume one, allow or reject. The lazy refill — computing accrued tokens from the timestamp instead of running a timer — is the implementation detail that makes it cheap: the limiter does no work between requests.
Two properties fall out of the mechanics. Burst tolerance: a quiet minute fills the bucket to capacity, so a sudden spike of up to capacity requests passes before the faucet rate takes over. And smoothness: unlike a fixed window that resets to zero, the bucket never rejects a request that the average rate can afford. The stages are ordered by what the limiter knows at each moment — and the atomic consume step is what keeps concurrent requests honest.