Async and streaming / Beginner / 6 min
A message queue between services
Backlog, consumer capacity, retries and dead letters. See why queues absorb bursts but not overload.
Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.
In short
- What it is
- A message queue sits between producers and consumers; consumers take messages at their own pace and retry failures.
- Why it matters
- It absorbs traffic spikes and lets slow work happen later, so the user does not wait for it.
- The trade-off
- Work becomes asynchronous, so you need retries, a dead-letter queue and idempotent consumers because a message may arrive twice.
- Say it in an interview
- "I would put the slow work on a queue with retries and a dead-letter queue, and make the consumer idempotent."
Check yourself
Messages arrive faster than consumers can process them, all day. What happens?
Answer: The backlog grows without limit until something breaks. Queues smooth bursts. Sustained overload needs more consumers or less work.
What is a dead-letter queue for?
Answer: Messages that failed too many times, set aside for inspection. After the retry limit, a poison message moves aside so it stops blocking or wasting consumers.
Why must queue consumers be idempotent?
Answer: Because a message can be delivered more than once. With at-least-once delivery, a retry after a timeout can process the same message twice.