Prefetch — how many in flight per worker

Prefetch caps how many un-acked messages a single worker holds in flight: too low starves throughput on network round-trips, too high lets one greedy worker hoard the queue while siblings idle.

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 09a

Prefetch — how many in flight per worker

  1. Watch
  2. Try it
  3. Predict
  4. Capture
SYSTEM THROUGHPUT19.5 msg/sprefetch = 1headtailc-0c-1c-2c-3c-4c-5c-6c-7c-8WORKERS · 4Worker 14.9 msg/sprefetch=1Worker 24.9 msg/sprefetch=1Worker 34.9 msg/sprefetch=1Worker 44.9 msg/sprefetch=1
What to watch for

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.

Continue unlocks when the animation finishes.

Where this sits in Build a Message Queue (RabbitMQ / SQS)

Scene 09a of 14. Per-worker cap on un-acked in-flight messages. Too low → throughput collapse on RTT; too high → one greedy worker hoards.

Up next. Now we have throughput tuned. But every scene so far implicitly assumed order doesn't matter — workers race for the head. What if order does matter? Then competing consumers and FIFO start to fight each other.

All 14 scenes in Build a Message Queue (RabbitMQ / SQS) · Every curriculum

Built with Arqly
Every scene in Build a Message Queue (RabbitMQ / SQS) builds on the one before it.All 14 Build a Message Queue (RabbitMQ / SQS) scenes