Build a Message Queue (RabbitMQ / SQS) (14 scenes)
Scene 9.5 · Prefetch — how many in flight per worker
Per-worker cap on un-acked in-flight messages. Too low → throughput collapse on RTT; too high → one greedy worker hoards.
Previously
Each grey cell has its own countdown — and the broker is happy to hand a worker more than one. How many it hands out per worker is its own knob, and it has its own symmetric failure modes.
Scene 9.5
Prefetch — how many in flight per worker
Diagram
Top: the shared queue strip — messages waiting at the head. Below: a pool of workers, each with a dashed in-flight buffer of size = prefetch. When a worker grabs a message it lands in that worker's buffer until it's acked. The right-hand bar is each worker's throughput; the box at top right is the system-wide sum.
Watch the two extremes side by side. Prefetch = 1: each worker holds one message at a time — bars are perfectly even but modest, because every fetch pays a network round-trip. Then prefetch jumps to unbounded — one worker grabs the whole visible queue and the other three sit flat. Same workers, same queue, same job — the only thing that changed is the prefetch cap.