Pattern

Queues

Decouple producers from consumers with an ordered buffer, from a single-process counter to a durable distributed log.

What it is

A queue holds items in the order they arrive (or by priority) so a producer and a consumer can run at different speeds without either blocking on the other. At small scale this is a language-level structure — a deque tracking events inside a trailing time window. At system scale it becomes an infrastructure component in its own right: a durable, partitioned log that absorbs bursts, lets consumers fall behind and catch up, and lets independent stages of a pipeline fail and retry without losing work. What changes between the two scales is what you must guarantee about ordering, durability, and delivery once a single in-memory list can't hold everything.

When it applies

Tells in the problem

The classic mistake

At small scale, the common bug is treating a trailing window as a fixed-size buffer instead of expiring by time — counting hits by index or a rolling array size rather than checking each entry's actual timestamp against the current one, which breaks the moment calls arrive irregularly rather than one per unit time. At system scale, the parallel mistake is promising an ordering or delivery guarantee the chosen queue shape can't actually provide — claiming full global ordering across a topic that's partitioned for throughput, or treating "the message was enqueued" as equivalent to "the message was durably committed" when a producer's write hasn't yet been acknowledged by enough replicas to survive a machine loss. Say precisely what's ordered (per-key, not globally) and what's durable (acknowledged and replicated, not merely accepted) rather than letting the word "queue" imply guarantees you haven't built.

Questions to start with

All 4 queues questions

Problem statement, examples and hints are free on every page; the worked approach, solution and tests are in the company guides.

Free starter pack

13 must-tier questions with full solutions

Sign in with an email — no purchase — and read them in the full reader.

No password, no spam. One sign-in email; you can read the pack in the full reader.