Lab · Messaging

Queues & backpressure

A queue lets a producer hand off work faster than workers finish it — for a while. When arrivals stay above what workers can process, something has to give: the queue grows, work is dropped, or the producer is slowed down.

Try it

Lab time 3.0 s
Producer, 3 items/sProducer3 items/ssending freelyQueue, holds up to 12Queueholds up to 121 waitingWorkers × 2, ~4.0 items/s totalWorkers × 2~4.0 items/s total2 busyDone, 7Done7
  • Producer — 3 items/s — healthy — sending freely
  • Queue — holds up to 12 — healthy — 1 waiting
  • Workers × 2 — ~4.0 items/s total — healthy — 2 busy
  • Done — 7 — healthy
  • Asynchronous
  • Request
  • Error / rejected
  • Response
Queue depth
1/ 12
Utilization
75%
Healthy: healthy headroom
Time in system,
990 ms
Dropped
0
Waiting at the producer
0
Processed
2/s

Numbers add up:10 arrived = 7 done + 2 in progress + 1 queued + 0 waiting upstream + 0 dropped + 0 in transit · Little's law: 3 in system ≈ 2/s × 0.7 sThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

Load
3.0/s
Capacity
2
500 ms
When the queue is full

When the queue is full, reject new work at once (load shedding).

12
Criticality

3 in 10 items are critical; sheddable items are dropped first once the queue is three-quarters full.

Queue depth
05101520Queue limit1s2s3s
Show data table
TimeItems waiting
1s0
1s1
2s0
2s0
3s0
3s1
Arrivals vs. processed (items/s)
ArrivedProcessed
01.32.53.851s2s3s
Show data table
TimeArrivedProcessed
1s40
1s20
2s44
2s44
3s44
3s22

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • Items take a random 0.5–1.5× the average processing time and arrive randomly (Poisson). Real traffic is burstier still.
  • The unbounded queue "crashes" at 150 items to stand in for running out of memory.
  • "Block" pauses the producer instantly. Real backpressure travels through TCP windows, bounded channels, or explicit signals such as HTTP 429 + Retry-After.