cloudpatterns.appClassroomKatasWhiteboardBlog
Resilience LineLesson

Backpressure — a queue that says no

A queue in front of a slow consumer grows until it hurts unless it has a limit. A bounded queue that refuses new work when full tells the producer at once to slow down; an unbounded one hides the problem as ever-longer delays and growing memory. Refusing is a signal; dropping is losing work.

11 minMediumStation: Backpressure

Members lesson

Membership isn’t open yet. The free lessons are open — 16 of them.

  1. Bulkhead
  2. Load shedding
  3. Backpressure
  4. Rate limiting
  5. Sale day
Resilience Line — where this lesson sits

What you'll be able to do

  1. 1Explain how a bounded queue that refuses new work when full tells producers to slow down, and why an unbounded queue only hides the problem.
  2. 2Predict queue depth and waiting time when producers outpace the consumer, with an unbounded queue and with a bounded one.
  3. 3Choose what a full queue does — refuse the new item, drop it, or drop the oldest — for a given kind of work.

Inside the lesson

steps
10
questions
7
simulations
3

You guess first, then run the system and see if you were right.

Step 1 · The setup

At the last stop, the gateway refused the excess at once — shoppers were waiting for an answer. Some work doesn't need one straight away; as the Scale line showed, it can wait in a queue for a worker.

Checkout keeps its search index up to date that way. When a supplier imports its catalog, the Catalog API puts an “update the index” job in a queue for each product and tells the importer “accepted” as soon as it's queued. One indexer works through the jobs, 60 a second.

Normally about 20 updates a second arrive; today's import sends 120 a second for 30 seconds. The queue has no limit.

Steps 2–10 are for members