Design Delayed (Scheduled) Tweet Publishing for Twitter

Read the full interview experience this question came from →

Quick Overview

Design the delayed, or scheduled, tweet feature for Twitter, where a user writes a tweet now and it publishes automatically at a chosen future time. It tests requirements, data modeling, finding due tweets efficiently, exactly-once publishing, races between cancel and publish, predictable traffic spikes, and failure handling.

Design Delayed (Scheduled) Tweet Publishing for Twitter

Company: xAI

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

Design the delayed tweet feature for Twitter: a user writes a tweet now and has it published automatically at a later time. This was the system design round of an onsite for a software engineering role. The report gives only this one-line prompt, so settle the scope first. In its usual form the author chooses a future publish time, can see, edit, reschedule or cancel pending tweets until they go out, and at that time the tweet appears to followers like any other tweet. ```hint Time is the index Many tweets can fall due in the same second, while far more wait months ahead. Decide how the system finds every tweet that is due now without looking at the ones that are not. ``` ```hint Cancels race with publishing An author can cancel or edit a tweet at the very moment it becomes due. Decide what makes publishing happen exactly once and lets the cancel cleanly win or lose. ``` ### Constraints and Clarifications - Not given: how far ahead a tweet can be scheduled, the time precision required, the number of scheduled tweets, and which kinds of tweet can be scheduled. Ask, or state your assumptions. - The report does not say whether "delayed" means a publish time the author picks or a short fixed delay before every tweet goes out; the usual reading is the former, so confirm it. ### Clarifying Questions - Is the delay a publish time the author picks, or a short fixed delay applied before a tweet goes out? - How far ahead can a tweet be scheduled, and at what granularity (minute or second)? - How late may a tweet appear after its scheduled time, and may it ever appear early? - Can a scheduled tweet be edited, rescheduled or cancelled, and until when? - Which content can be scheduled: text, media, polls, replies, threads? Are content checks run at scheduling, at publishing, or both? - What should happen if the account is suspended, deleted or made private before the tweet goes out? - How many tweets are scheduled per day, and do many fall due at the same moment, such as midnight on New Year's Eve? ### What a Strong Answer Covers - Requirements and estimates, including the spike when many tweets fall due at once - A data model and APIs for creating, listing, editing and cancelling scheduled tweets - A time-ordered index and a scheduler that finds due tweets without scanning everything and scales horizontally - Exactly-once publishing, and a clean outcome when a cancel or edit races with publishing - The handoff to the normal tweet path: the tweet id, its timestamp, timeline delivery and notifications - Failure handling (scheduler crash, backlog after an outage, clock skew, downstream outage) and monitoring of publish delay ### Follow-up Questions - One million tweets are scheduled for exactly midnight on New Year's Eve. What breaks first, and how do you prepare? - A user cancels a tweet one second before its publish time. How do you guarantee it is never published? - The scheduler was down for 20 minutes. What happens to the tweets that were due during the outage? - How would you let users schedule a whole thread so that its tweets appear together and in order?

Overview: Design the delayed, or scheduled, tweet feature for Twitter, where a user writes a tweet now and it publishes automatically at a chosen future time. It tests requirements, data modeling, finding due tweets efficiently, exactly-once publishing, races between cancel and publish, predictable traffic spikes, and failure handling.

Read the full xAI Software Engineer interview experience this question came from

xAI logo
xAI
Sep 23, 2026
mediumSoftware EngineerOnsiteSystem Design
1
0

Design the delayed tweet feature for Twitter: a user writes a tweet now and has it published automatically at a later time. This was the system design round of an onsite for a software engineering role. The report gives only this one-line prompt, so settle the scope first. In its usual form the author chooses a future publish time, can see, edit, reschedule or cancel pending tweets until they go out, and at that time the tweet appears to followers like any other tweet.

Constraints and Clarifications

  • Not given: how far ahead a tweet can be scheduled, the time precision required, the number of scheduled tweets, and which kinds of tweet can be scheduled. Ask, or state your assumptions.
  • The report does not say whether "delayed" means a publish time the author picks or a short fixed delay before every tweet goes out; the usual reading is the former, so confirm it.

Clarifying Questions Guidance

  • Is the delay a publish time the author picks, or a short fixed delay applied before a tweet goes out?
  • How far ahead can a tweet be scheduled, and at what granularity (minute or second)?
  • How late may a tweet appear after its scheduled time, and may it ever appear early?
  • Can a scheduled tweet be edited, rescheduled or cancelled, and until when?
  • Which content can be scheduled: text, media, polls, replies, threads? Are content checks run at scheduling, at publishing, or both?
  • What should happen if the account is suspended, deleted or made private before the tweet goes out?
  • How many tweets are scheduled per day, and do many fall due at the same moment, such as midnight on New Year's Eve?

What a Strong Answer Covers Guidance

  • Requirements and estimates, including the spike when many tweets fall due at once
  • A data model and APIs for creating, listing, editing and cancelling scheduled tweets
  • A time-ordered index and a scheduler that finds due tweets without scanning everything and scales horizontally
  • Exactly-once publishing, and a clean outcome when a cancel or edit races with publishing
  • The handoff to the normal tweet path: the tweet id, its timestamp, timeline delivery and notifications
  • Failure handling (scheduler crash, backlog after an outage, clock skew, downstream outage) and monitoring of publish delay

Follow-up Questions Guidance

  • One million tweets are scheduled for exactly midnight on New Year's Eve. What breaks first, and how do you prepare?
  • A user cancels a tweet one second before its publish time. How do you guarantee it is never published?
  • The scheduler was down for 20 minutes. What happens to the tweets that were due during the outage?
  • How would you let users schedule a whole thread so that its tweets appear together and in order?