Design an SQS-Style Delay Queue With Per-Message Visibility Timers
Last updated: November 29, 2026
Quick Overview
Design a managed queue that lets producers send messages that become visible only after a delay of up to 15 minutes, and that hides received messages for a visibility timeout so a crashed consumer's message reappears.
Amazon
November 29, 20260
0
0 solved
Design a managed queue that lets producers send messages that become visible only after a delay of up to 15 minutes, and that hides received messages for a visibility timeout so a crashed consumer's message reappears.
AWS interviewers like asking candidates to design pieces of services they know, and SQS timers test time-based scheduling inside a distributed queue. They check data layout for due-time ordering, at-least-once semantics, and how visibility timeouts and deletes interact.
What the Interviewer Expects
- Explain at-least-once delivery and the receipt handle model
- Store messages so due messages can be found efficiently
- Implement delay and visibility as the same 'visible_at' mechanism
- Handle receives across many partitions of one queue
- Support dead-letter queues after max receives
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How would you add FIFO ordering with message groups?
- What if a consumer extends the visibility timeout repeatedly?
- How do you scale one queue receiving a million messages per second?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: SendMessage with optional delay (0 to 900 seconds), ReceiveMessage (up to 10, long polling), DeleteMessage with a receipt handle, ChangeMessageVisibility; redrive to a DLQ after N receives...
High-Level Design
A front-end fleet routes requests. Each queue is split into partitions, each owned by a storage node group (a leader plus replicas with a replicated log). A partition stores messages with `message_id,...