Academy · Messaging & Async

Message queues

If service A calls service B synchronously, B's slowness or outage becomes A's problem, and bursts overwhelm B.

Open the interactive version → diagrams, practice & more

The problem

If service A calls service B synchronously, B's slowness or outage becomes A's problem, and bursts overwhelm B.

The idea

Put a queue between them. A writes messages; B consumes at its own pace.

How it works

Producers enqueue work; the queue buffers it durably; consumers pull and process. This decouples availability (A works even if B is down) and smooths bursts (the queue absorbs spikes).

The tradeoff

You gain resilience and buffering but add eventual processing (work isn't done instantly) and must handle ordering/duplicates.

In the wild

Kafka, RabbitMQ, SQS. Order placed → queue → email, inventory, analytics consumers.

Interview deep dive

Flow

  1. Producer validates the request and writes a durable message.
  2. Queue acknowledges once the message is safely stored.
  3. Consumers pull at their own pace and commit progress.
  4. Retries use idempotency keys; poison messages move to a DLQ.

Watch for

Interviewer trap

Name the retry, duplicate, and DLQ behavior before drawing more boxes.

Related Academy

Part of Academy on SystemLore — system design interview prep with 148 deep topics, interactive diagrams, and a practice game. Practice this one →