Interview Q&A · questions with model answers
Messaging & Queues Interview Questions
Part of the study plan for: Backend Engineer · Data Engineer · Site Reliability Engineer (SRE)
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked How do you make message consumers idempotent?
Give each message a unique ID and record processed IDs (in the same transaction as the business change, with a unique constraint), design operations as upserts or absolute state changes ('set status…
-
How do you guarantee message ordering?
Ordering is only guaranteed within a partition (Kafka), a FIFO queue/message group (SQS FIFO), or a single queue with one consumer. Route related messages (same order or account) with the same…
-
How do you design background job processing for a web application?
Enqueue jobs with the minimal data needed (IDs), process them in separate worker processes with retries, timeouts and DLQs, make jobs idempotent, prioritize queues, schedule recurring jobs…
-
How do you evolve message schemas safely?
Use a schema format with compatibility rules (Avro, Protobuf, JSON Schema) and a schema registry, make changes backward and forward compatible (add optional fields with defaults, never reuse or…
-
What should you monitor in a messaging system?
Queue depth and age of the oldest message (consumer lag), throughput in/out, processing latency, error and retry rates, DLQ size, consumer count/health, broker resource usage, and end-to-end latency…
-
How do you test asynchronous, message-driven code?
Unit test handlers as plain functions with message fixtures, integration test with real brokers in containers (Testcontainers), use contract tests for event schemas, and assert eventual outcomes…
-
How do you implement priority processing?
Use separate queues per priority with more consumers (or weighted polling) on high-priority queues, or broker priority features (RabbitMQ priority queues, BullMQ priorities). Prevent starvation of…
-
How do you increase throughput of message processing?
Scale consumers (up to partition limits), batch reads and writes, process messages concurrently within consumers where ordering allows, tune prefetch/poll sizes, reduce per-message I/O (bulk DB…
-
How do you secure message brokers?
Authenticate producers and consumers (SASL/mTLS/IAM), authorize per topic/queue with least privilege, encrypt in transit and at rest, avoid sensitive data in messages or encrypt payload fields, and…