Asynchronous Messaging
maang.io System Design Series
Asynchronous messaging lets a producer hand off work and move on, decoupling services in time and space so they scale and fail independently. The subject is really about guarantees: point-to-point queues vs pub/sub fan-out, at-most/at-least/exactly-once delivery, ordering, dead-letter queues, and backpressure. It's the backbone of resilient, spike-tolerant systems.
This deep dive comes in three parts:
- Foundations & Core Concepts — queues vs pub/sub, brokers, and decoupling.
- Internals — delivery guarantees, ordering, DLQs, visibility timeouts, and backpressure, with worked examples.
- Interview — Staff/Principal Q&A: exactly-once reality, idempotency, and failure handling.
Asynchronous Messaging — Part 2: Internals & Delivery Mechanics
maang.io System Design Series
What is this?
Back to the mailroom. In Part 1 we watched people drop letters off and pick them up. Now we go behind the counter and see how the mailroom actually works: where letters are stacked, how a clerk knows a letter is "out for delivery" versus "waiting," what happens when a delivery fails, and how the mailroom keeps from being buried when mail arrives faster than it can be handled.
Those behind-the-counter mechanics — how the broker stores messages, tracks in-flight work, redelivers on failure, and pushes back under load — are what separate someone who's used a queue from someone who can design on one. Every one of them shows up in interviews and, more importantly, in production incidents. Let's open the door.
The one-line idea: A broker is a durable buffer with a checkout desk. Messages sit in durable storage; when a consumer "receives" one, the broker doesn't delete it — it hides it for a timeout and waits for an ack. Delete on ack, redeliver on timeout. Every mechanic in this chapter — visibility timeouts, retries, DLQs, ordering — is an elaboration of that one loop.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson