Concept Drills: 16 Messaging Queue Probes
Cover the answer, attempt it out loud, then compare. A definition is not an interview answer — a decision is.
1. What does a queue actually buy you?
Weak: "It makes things asynchronous."
Strong: "It decouples the producer's fate from the consumer's. Without it, the producer inherits the consumer's latency, capacity, and outages — and the call is only as available as the product of both services. With a queue, the producer's obligation ends at 'the message is durably stored,' which is a much cheaper promise. Everything else — buffering spikes, independent scaling, retrying failed work — follows from that one property."
2. Point-to-point or pub/sub?
Weak: "Pub/sub is more flexible."
Strong: "They do opposite things when you add a consumer. In point-to-point, a second consumer splits the work — two workers each take half. In pub/sub, a second subscriber duplicates it — both get every message. So: resizing thumbnails is point-to-point, because you want the job done once by whoever's free. Notifying five services that an order was placed is pub/sub, because each needs its own copy and adding a sixth shouldn't change the publisher. Getting this backwards means every worker does every job."
3. What's the limit of a queue as a buffer?
Weak: "It can fill up."
Strong: "A queue absorbs a burst; it does not absorb a sustained overload. If producers exceed consumer throughput on average, the queue grows without bound — you've converted an immediate failure into a delayed one with steadily rising latency until you hit the size limit. A queue buys time, not capacity. What you do with that time — autoscale, shed load, alert — is the actual mitigation."
4. Why is idempotency mandatory rather than a best practice?
Weak: "Because messages might be duplicated."
Strong: "Because at-least-once delivery guarantees duplicates, and the queue structurally cannot prevent them. A consumer processes a message successfully, then dies before its ack arrives. The queue can't distinguish that from a consumer that died before doing the work, so it redelivers. That's the RPC failure-semantics problem: the sender can't tell 'never arrived' from 'response never came back.' If the handler charges a card, at-least-once means charging twice. Idempotency lives in the consumer because nothing upstream can provide it."
5. How do you actually make a handler idempotent?
Weak: "Check if we've seen the message before."
Strong: "Three levels. Naturally idempotent operations — prefer SET status='shipped' over INCREMENT count; absolute writes repeat safely, relative ones don't. Dedup by message ID in a store with a TTL — but that's only as strong as the atomicity between recording the ID and doing the work; if they're not one transaction you've moved the race, not removed it. Idempotency keys at the business level (order-1234-charge), where the downstream treats a repeat as the same operation and returns the original result — that's how payment APIs do it, and it survives across service boundaries where message IDs don't."
6. Does frontend deduplication give exactly-once delivery?
Weak: "Yes, that's what dedup is for."
Strong: "No, and conflating them is a detectable error. Frontend dedup stops the same message being enqueued twice — a producer that retried because it never saw our response. The duplicate that actually matters happens after the message is safely in the queue, when a consumer processes it and dies before acking. No frontend check can see that, and redelivery there is deliberate. Frontend dedup guards enqueue; consumer idempotency guards processing. You need both."
7. Why does a single-server queue get slower as you add clients?
Weak: "One machine can only do so much."
Strong: "Because the queue is a critical section — one entity accesses it at a time via a lock. Adding producers and consumers doesn't add throughput, it adds contention: acquiring, blocking, context-switching, retrying. Past a point, more clients make it slower in absolute terms, because time goes into coordination rather than work. It degrades inversely with load, which is why the fix isn't a bigger machine."
8. Who assigns sequence numbers for strict ordering, and why?
Weak: "The server, when messages arrive."
Strong: "The producer must, because only the producer knows production order. By the time a message reaches the server, the network has already destroyed that information — any order the server invents is order by arrival, which is precisely what strict ordering exists to correct. And a server-side counter is worse than nothing: a message produced second but arriving fourth gets stamped 4, so the system records the wrong order as authoritative and nothing downstream can recover the truth. Best-effort at least admits it doesn't know."
9. Rank the three ordering mechanisms.
Weak: "Timestamps are best."
Strong: "Monotonic server-side counters: a bottleneck during bursts, and blind to network delay — worst option. Client-side timestamps (causality-based): respect production time, but clock skew across machines makes two clients' timestamps incomparable, so messages produced close together can invert. Synchronized-clock timestamps: unique, globally ordered, with a process ID tagged on to break ties among concurrent requests — and they let the server recognize and wait for a delayed message. That's the sequencer building block: uniqueness from the process ID, ordering from the synchronized clock."
10. What does strict ordering cost?
Weak: "Some latency from sorting."
Strong: "Two things. Latency — you sort within a bounded time window waiting for stragglers, and every message pays it, not just the late ones. Size the window from the p99 of observed arrival skew. Throughput — and this is the one people miss: message N can't be delivered before N-1, so you can't run ten workers concurrently. Strict order caps consumer parallelism, which is usually why you built a distributed queue. That's why the standard answer is to scope order to a partition: your ordering domain is your parallelism domain, so make it as small as correctness allows."
11. Locking or serialization for concurrent access?
Weak: "Serialization — it's lock-free."
Strong: "Serialization, and the reason isn't obvious since both process one request at a time. The difference is where the waiting happens. With locking, every contender actively participates in the contention — acquire, block, context-switch, wake, retry — and that overhead grows with contenders. With serialization, contenders just append to a buffer, cheap and non-blocking, and one thread drains it at full speed with zero coordination cost. The work is still sequential; the overhead around the work is gone. Same insight as Redis's single-threaded design. And to break the single-thread ceiling: many independently-serialized queues."
12. Pull or push, and why?
Weak: "Push is faster — no polling."
Strong: "Pull, with long polling. Under push, if the broker sends faster than the consumer processes, the messages are already in flight — the backlog relocates into the consumer, which has no durability. The queue was supposed to be the buffer. You can add prefetch limits, but a prefetch limit is pull, reimplemented on top of push. Meanwhile long polling holds the request open at the broker, so you get push's latency anyway while the consumer keeps control of the rate. Pull also batches naturally — 'give me 500' is one round trip — and when per-message work is small, per-message overhead dominates."
13. Why are there two kinds of cluster manager?
Weak: "One is inside the cluster, one is outside."
Strong: "Because otherwise the coordinator's state grows with the entire fleet and becomes the system's bottleneck. The internal manager knows every node in its cluster, listens to their heartbeats, handles host failure and additions, and partitions a queue into parts each with a primary. The external manager knows about clusters and deliberately does not know what's inside them — it monitors cluster health and may split a queue across clusters. So external state grows with cluster count (small), internal state with hosts-per-cluster (bounded). It's hierarchical coordination — the same reason DNS delegates instead of holding one global table."
14. Primary-secondary or a cluster of independent hosts?
Weak: "Primary-secondary is more standard."
Strong: "The deciding question is whether each queue needs a named owner. Primary-secondary: all writes for a queue pass through one host, so that host observes the whole sequence and can impose a total order — the only way to get strict ordering. The cost is that when the primary dies, the queue is unavailable until an election completes, even though secondaries hold the data. Independent hosts: any host takes the write and replicates from a local queue-to-host table — no election, no stall, no hotspot, but no total order, because nobody sees the full sequence. It's leader versus leaderless. Ordering required → model 1. Availability and throughput → model 2."
15. Synchronous or asynchronous replication for a queue?
Weak: "Async — it's faster, and some lag is fine."
Strong: "For a queue, async means acknowledged messages can vanish silently. The producer is told 'received' when only the primary has it. If the primary dies in that window: the message is gone, the producer believes it succeeded and will never resend, no consumer ever sees it, and no error is raised anywhere. Once we ack, ours is the only copy — unlike a cache, nothing can rebuild it. So if durability is a stated requirement, the answer is synchronous to at least one replica before acknowledging, and the cost is a round trip on the write path plus reduced availability during elections. That's the price of the requirement — pay it, but say you're paying it."
16. Offset tracking or visibility timeout?
Weak: "Whichever the technology supports."
Strong: "Ask: stream or work queue?
Offset tracking (Kafka) — messages aren't removed; consumers track their own offset and a background job deletes on expiry. Gives replay and free fan-out, since nobody's reads interfere. Costs full-retention storage, and per-message retry is awkward because one poison message sits at an offset everyone must pass.
Visibility timeout (SQS) — receiving hides the message for a period; the consumer must explicitly delete it, and if it crashes the message reappears. That's where at-least-once comes from, and it gives per-message retry naturally, which is why DLQs fit it so well.
Stream with multiple readers and value in history → offsets. Jobs that need doing once each with independent retry → visibility timeout. And with visibility timeout, size it off p99.9 processing time and extend it via heartbeat — a timeout expiring mid-processing duplicates work under exactly the load conditions that caused it, so a slow consumer becomes a duplicate storm."
Key takeaway
The pattern across the strong answers: name which requirement forces the choice, state what the alternative silently costs, and be precise about which guarantee a mechanism actually provides — most of the errors in this chapter are guarantees claimed one level too strong.