Design a Delayed Job Queue for Expiring Instagram Stories

Last updated: November 29, 2026

Quick Overview

Design a delayed-execution service that fires an event exactly when each Instagram Story turns 24 hours old, so it is removed from viewers' trays, moved to the creator's archive, and dropped from caches.

Meta
System Design
Software Engineer
Meta
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design a delayed-execution service that fires an event exactly when each Instagram Story turns 24 hours old, so it is removed from viewers' trays, moved to the creator's archive, and dropped from caches.

Instagram publishes hundreds of millions of stories a day, each with a hard 24-hour lifetime, which makes it a natural delayed job queue question. The interviewer checks whether you avoid a naive full-table scan, choose a timer structure that scales (bucketed time wheel), and pair it with read-time filtering so correctness does not depend only on the timer.

What the Interviewer Expects
  • Recognize read-time filtering as the correctness guarantee
  • Use time-bucketed storage or a timing wheel for billions of timers
  • Fan out expiry side effects to archive, caches and indexes
  • Handle backlog after an outage without missing events
  • Make handlers idempotent
Key Topics to Cover
delay queues
timing wheel
time bucketing
read-time filtering
idempotent handlers
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • Why not just set a TTL in the database and be done?
  • How would you support Close Friends stories or creators who delete early?
  • What changes if Highlights let creators keep a story past 24 hours?
  • How do you measure that expiry is on time?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: when a story is posted at time tt, schedule an expiry job for t+24ht + 24h. At expiry: remove it from tray rankings and feed caches, move it to the creator's private archive, update coun...

High-Level Design

Two layers. Correctness at read time: the tray and story viewer filter out any story with created_at < now - 24h, so a late timer never shows an expired story. **Side effects via a delay queue:*...


Submit Your Answer
Markdown supported