RSS Amplifier

System Design Nuggets · Aug 9, 2026

Message Queues in System Design Interviews: 12 Diagrams You Should Be Able to Draw

0
Sign in to vote or save

Arslan Ahmad · System Design Nuggets

In a system design interview, adding a message queue to a design is easy. Drawing a box labeled Kafka, connecting it with arrows, and saying something about decoupling takes thirty seconds. What happens in the next thirty seconds is what separates candidates.

The interviewer says that is great, can you walk me through how that queue actually works?

Or what delivery guarantee does it provide?

Or what happens if a consumer crashes mid-processing?

Or how do you handle a message the consumer keeps failing on?

Or what happens when your consumer falls behind and the queue fills up?

These questions are not difficult if you understand queues. They are impossible if you only know how to draw the box. The difference is not vocabulary. It is whether you can visualize the mechanism, the internal state of the queue and the behavior of the components around it under various conditions.

Diagrams are the fastest way to build that visualization.

A good queue diagram does not show a box with an arrow going in and an arrow going out. It shows the messages inside, the acknowledgment mechanism, the failure path, and the state transitions.

Twelve of these diagrams, covering every core concept, give you a complete mental model of message queues that holds up under any follow-up question.

What it shows: The foundational relationship between a producer, a queue, and a consumer.

What to draw: Draw a producer service on the left with an arrow labeled publish pointing to a queue in the center. Show the queue as a rectangle with messages stacked inside as numbered boxes (1, 2, 3, 4) showing order.

Draw a consumer service on the right with an arrow labeled consume pointing from the queue.

Show the consumer processing message 1 and message 2 waiting in the queue. Label the queue as durable with a disk icon below it.

The queue holds messages durably between production and consumption. The producer does not wait for the consumer to process. The consumer pulls at its own pace. The queue absorbs the gap between them.

What the interviewer scores: Whether you describe the decoupling correctly and whether you note that the queue must be durable for the guarantee to hold.

Trade-off: If the consumer cannot keep pace with the producer, messages accumulate and queue depth grows. A queue that grows without bound will eventually exhaust storage. Bounded queues with backpressure address this, which diagram 9 covers.

What it shows: How a queue guarantees messages are not lost even when consumers fail.

What to draw: Draw a queue on the left with messages 1, 2, 3 inside.

Draw a consumer on the right. Draw four states as a numbered sequence.

State 1: the queue delivers message 1 to the consumer and marks it in-flight, shown by moving message 1 to an in-flight area separate from the queue with a visibility timeout clock. State 2a (happy path): the consumer processes message 1 successfully and sends an acknowledgment (ACK) back to the queue, which deletes message 1.

State 2b (failure path): the consumer crashes before acknowledging and the visibility timeout expires, shown by the clock running out and message 1 returning to the queue marked as available for redelivery.

The acknowledgment mechanism is the single most important concept in message queue reliability. Without it, a consumer crash would silently lose whatever message it was processing.

What the interviewer scores: Whether you understand that the message stays in the queue until acknowledged, not until delivered, and whether you explain the visibility timeout as the recovery mechanism.

Trade-off: The visibility timeout must be longer than the maximum processing time or messages will be redelivered while still being processed, causing duplicate processing. Too long a timeout delays recovery from a genuine crash.

What it shows: The three delivery guarantee models side by side with their failure behaviors.

What to draw: Draw three columns labeled At-Most-Once, At-Least-Once, and Exactly-Once. For at-most-once, draw the queue deleting the message immediately on delivery before the consumer confirms processing. Show the consumer crashing and the message being gone, labeled message lost, no retry.

For at-least-once, draw the acknowledgment mechanism from diagram 2. Show the consumer crashing and the message being redelivered, labeled possible duplicate.

For exactly-once, draw the at-least-once mechanism plus an idempotency key check on the consumer side, labeled processed check before acting, with a deduplication store recording processed message IDs.

This diagram is the most commonly probed concept in message queue interviews. Most candidates know the names but cannot draw the mechanism behind each one.

What the interviewer scores: Whether you know that exactly-once delivery is not a native queue guarantee but is achieved through at-least-once delivery combined with idempotent consumers.

Trade-off: At-most-once is fastest (no acknowledgment overhead) but loses messages. At-least-once is the practical default (reliable but requires idempotent consumers). True exactly-once requires a deduplication store that adds latency and storage overhead.

What it shows: How a consumer handles duplicate message delivery safely using an idempotency key.

Read the original on designgurus.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.