SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 18
Design a shared calendar with invitations
People open their calendar many times a day to see what is next, drag meetings around, and invite colleagues in other cities. A weekly team meeting may repeat for years, with the odd week moved or cancelled, and everyone expects it to show up at the right local time on their own screen and to get a reminder before it starts.
Requirements
- Create one-off and recurring events (for example every weekday at 09:00, or the second Tuesday of each month), and edit or cancel a single occurrence or all following occurrences.
- Invite other users; each invitee sees the event on their calendar and can accept, decline or mark maybe, and the organizer sees the responses.
- Show a day, week or month view quickly in the viewer's own time zone.
- Show colleagues' free/busy times (without event details) when picking a meeting slot.
- Send a reminder a chosen number of minutes before each occurrence.
Constraints and assumptions
- 100 million users, 20 million daily active; users span every time zone, including ones with daylight saving changes on different dates.
- About 200 million calendar views a day, peaking around 10,000 per second; each week view shows about 50 events.
- About 50 million event creates and edits a day; meetings have up to 1,000 invitees.
- About 100 million reminders a day; each must arrive within 30 seconds of its time, and many meetings start exactly on the hour.
- A user who edits an event must see the change on their next view; invitees may see it a few seconds later.
Out of scope for the first sketch
Meeting room and resource booking · Sync with external calendars over open protocols · Video conferencing links
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design a shared calendar with invitations
Finish your first sketch before answering these. Cross out freely.
- How do you store "every weekday at 09:00, no end date"? What changes in storage when one occurrence is moved to 10:00?
- The organizer is in New York and an attendee is in London, and their clocks change on different dates in March. What do you store, and what time does each person see that week?
- A recurring meeting with 400 attendees is moved to a new time. What gets written, and how does each attendee's week view pick up the change?
- Find a free hour for 8 people in the next two weeks. Where is that computed, and what data does it need?
- At 08:50 in a busy time zone, millions of reminders for 09:00 meetings are due in the same minute. How do you deliver them all within 30 seconds?
Compare afterwards: worked approaches and reading at sketchbook /questions/calendar-scheduling/review