"Design Google Calendar" fools people twice. First, it looks like a CRUD app with a date picker: a table of events, a few endpoints, done. Second, it looks like a scale question, and it is not. Calendar traffic is modest and spread across millions of independent users.
The difficulty is in the data model. How do you store "every Tuesday at 9:00 for the next two years, except the week of the holiday, and move this one to Thursday"? What does "9:00" mean for an attendee in another time zone when daylight saving time changes? How do you answer "is everyone free on Friday afternoon" for ten people at once? And how do you stop two people from booking the same meeting room at the same moment?
Interviewers use it to see whether you model time carefully, and whether you can say where you need strong consistency and where you do not.
Clarify the requirements
Functional requirements:
- Create, edit and delete events with a title, start, end, location and description.
- Recurring events (daily, weekly, monthly, "every second Tuesday"), with edits to one occurrence, to "this and all following", or to the whole series.
- Invite attendees; they see the event on their own calendar and can accept or decline.
- Show a day, week or month view of one's own events and shared calendars.
- Reminders by notification or email before an event.
- Free/busy lookups across several people, and meeting room booking.
- Sync to phones and other clients.
Out of scope, said aloud: video conferencing links, natural-language event creation ("lunch with Sam tomorrow"), smart scheduling suggestions and the external calendar import formats beyond a mention of iCalendar.
Non-functional requirements:
- Correct time, always. An event never moves by an hour because of a daylight saving change.
- Fast reads: a week view loads in under 200 ms. It is the dominant request.
- No double-booked rooms. A room can have at most one event at any moment.
- Reminders arrive on time, even though many fire at the same instant (the top of the hour).
- Durable. Losing someone's event is a trust-breaking bug. Eventual consistency of views is fine.
Estimate the scale
Assume 100 million daily active users, each creating 0.5 events a day on average (most days none, some days several) and loading a calendar view 6 times a day. An event is about 1 KB.
Writes: 100M × 0.5 = 50 million events a day ÷ 86,400 s ≈ 580 per second. With an average of 3 attendees each, per-attendee records bring that to about 150 million rows a day, or 1,740 per second.
Reads: 100M × 6 = 600 million a day ÷ 86,400 s ≈ 6,900 per second, about 20,800 per second at 3× peak.
Storage: 50M × 1 KB × 365 × 5 years ≈ 91 TB over five years. Recurring events store one rule, not every occurrence, which is why the number stays this small.
Reminders: each event averages 1.5 reminders: 75 million a day ÷ 86,400 s ≈ 870 per second on average. People schedule on round times, and reminders fire at 8:45, 9:00 and 9:15, so assume a burst at 20× the average: about 17,000 per second at the top of an hour.
"6,900 reads and 580 writes a second is small, and every user is an independent partition, so scale is easy. The care goes into the model: store time correctly, store recurrence as a rule, and use strong consistency only for rooms. The reminder burst at 9:00 is the one real spike."
Plug the figures into the capacity estimator.
API and data model
POST /v1/calendars/{cal}/events { title, start, end, tz, recurrence?, attendees[] }
GET /v1/calendars/{cal}/events?from=&to= -> expanded occurrences in range
PATCH /v1/events/{id} { scope: "this" | "following" | "all", changes, occurrenceStart? }
POST /v1/events/{id}/respond { status: "accepted" | "declined" }
GET /v1/freebusy?users=a,b,c&from=&to= -> busy blocks per user
GET /v1/sync?calendar={cal}&syncToken= -> changes since the tokenevent (event_id PK, organizer_id, title, start_local, end_local, tz,
rrule, until, version)
exception (event_id, original_start) -> overridden fields | canceled
entry (user_id, calendar_id, start_utc, event_id) // per-attendee index, by time
attendee (event_id, user_id) -> response_status
room_booking (room_id, during tstzrange) EXCLUDE USING gist // no overlapsThe non-obvious choice: events store a local time and a time zone ID (2026-12-07 09:00 in America/New_York), not only a UTC timestamp. For a one-off event they are equivalent. For a recurring event they are not, and the next section explains why.
High-level design
We simulate the read-heavy slice: a gateway, a stateless calendar API, a free/busy cache and the events store with read replicas.
- The calendar service answers views from the events store's replicas and free/busy lookups from the cache.
- Writes go to the primary and refresh the affected users' cached busy blocks.
Describe this diagram
Components
- users (Client)
- gateway (API gateway)
- calendar api (Service)
- free/busy cache (Redis)
- events store (PostgreSQL)
Connections
- users sends to gateway
- gateway sends to calendar api
- calendar api sends to free/busy cache
- calendar api sends to events store
Run it, then try raising the load or removing replicas, and watch where the reads queue first. Views dominate, and they only touch one user's rows, so adding replicas and a cache is enough.
The write path: create an event row, write one entry row per attendee into their own calendar partition, update each user's cached busy blocks and enqueue the reminders, all derived from the single event. Put the work after the first write on a queue, so the organizer's save returns quickly.
The read path: a week view is a range query on entry by (user_id, start_utc), joined to the event rows and expanded for recurrence. Because all of a user's rows live together, it is one partition.
The interesting problem: recurring events and time zones
"Weekly standup, Mondays at 9:00, forever." Three storage choices:
Approach A: materialize every occurrence
Insert a row for each date.
Good: the week view is a trivial range scan, and each occurrence can be edited independently.
Bad: "forever" is infinite, so you must cap it, and a daily event for five years is 1,825 rows. Editing the series (change 9:00 to 9:30) means rewriting every row. Fan out to 50 attendees and a single edit writes 90,000 rows.
Approach B: store only the rule and expand on every read
Keep one row with an RFC 5545 recurrence rule (FREQ=WEEKLY;BYDAY=MO) and compute occurrences when a view is requested.
Good: tiny storage, and a series edit is one row.
Bad: a time-range query can no longer use an index, because the occurrences do not exist as rows. You must load every recurring series a user has and expand all of them to see what falls in this week. For users with hundreds of series that is wasteful, and "who is free Friday" across many users multiplies it.
Approach C: a rule plus exceptions, with a materialized window
Store the master event with its rule, a list of exceptions (one occurrence moved, edited or canceled), and keep a rolling materialized index of occurrences for the next 12 months in the entry table. A background job extends the window daily, and a series edit rebuilds only that series' future entries.
Diagram, as text
- Master event with rule leads to Expander job
- Exceptions leads to Expander job
- Expander job leads to Entry index: next 12 months
- Week view leads to Entry index: next 12 months
- Entry index: next 12 months leads to Master event with rule
- Daily extender leads to Expander job
This is the answer to aim for: reads use an index, writes touch one master, and storage stays bounded. Edits follow the Google-style scopes:
- This event only: add an exception row for that occurrence.
- This and following: end the old series the day before (
UNTIL) and create a new master that starts at the changed occurrence. This is simpler and safer than rewriting a rule in place. - All events: edit the master and rebuild its future entries.
Time zones are where the bugs live. Store a recurring event's start as local wall-clock time plus an IANA zone ID (America/New_York), never as a fixed UTC offset. "Every Monday at 9:00 New York time" is 14:00 UTC in winter and 13:00 UTC in summer, and only the zone rules (the IANA time zone database) know when it changes. Expand the rule in the event's zone, then convert each occurrence to UTC for the index. Always ship the zone database as data you can update, because governments change rules with little notice. Also decide how to treat a local time that does not exist (spring forward) or occurs twice (fall back): shift forward in the first case and use the first occurrence in the second.
The second decision: where you need strong consistency
Almost everything here tolerates a short delay: a new event appears on a colleague's calendar a second later, and nobody is harmed. Meeting rooms are the exception. If two people book Conference Room A at 10:00 at nearly the same moment, both can be told yes unless the system makes the booking a single atomic decision.
Make it one. Put room bookings in a strongly consistent store and let the database enforce the rule: in Postgres, an exclusion constraint on (room_id, tstzrange(start, end)) rejects any overlapping row. A check-then-insert in application code cannot be safe, because two requests both pass the check before either inserts. The loser gets a conflict error and the UI offers another time.
For people, do not block overlapping events: real calendars allow them (you may have two tentative meetings). Show a conflict warning instead. This keeps the rest of the system free of locks and lets the calendar API be available and fast. The consistency patterns lesson is the framework: choose strong consistency for the one invariant that needs it, and eventual consistency for the rest.
Free/busy is the other read worth designing. For each user keep a compact list of busy intervals for the coming weeks in a cache, rebuilt when their entries change. Answering "is Friday afternoon free for these ten people" is ten cache reads and an interval merge, not ten database range scans. Return only busy blocks, never titles, which respects privacy.
Bottlenecks and failures
The top-of-the-hour reminder burst. 17,000 reminders a second at 9:00 sounds like a lot, but it is predictable. Store reminders in a time-bucketed index (reminder(fire_minute, event_id, user_id)) and have a worker claim the current minute's bucket ahead of time. Fan out through a queue with workers, and send the next minute's batch slightly early so delivery lands on time. Spread by a few seconds of jitter where exact timing is not needed.
A huge invite. An all-hands event with 50,000 attendees writes 50,000 entries. Do that asynchronously from the queue in batches, show it for the organizer immediately and let attendees' calendars fill in over seconds.
Sync. Clients keep a syncToken and ask for changes since it. The server stores a per-calendar change log with a monotonically increasing version. If the token is too old, return an "invalid token" error and the client re-syncs fully. This is much cheaper than re-sending a calendar.
Concurrent edits. Two people edit the same event. Use the version column for optimistic concurrency: an update succeeds only if the version matches, and the loser is told to reload. Last-write-wins is acceptable for a title and not for a time change someone else just made.
What if the cache is down? Views read from the database replicas, a little slower. Free/busy falls back to computing from entries. The system degrades but works.
What if the primary is down? Views continue from replicas, and creating or editing events fails until failover. Room booking, which needs the primary, shows a clear error and never guesses.
Abuse. Calendar spam, with invitations sent to strangers, is real. Let users restrict who can add events, and rate-limit invites per sender.
Trade-offs to name aloud
- Rule plus materialized window: more moving parts than a rule alone, in exchange for index-backed reads.
- Local time plus zone ID: correct across daylight saving changes, and it needs a maintained time zone database.
- Per-attendee entries: a fast read of one's own calendar, at the cost of write fan-out for large invites.
- Strong consistency only for rooms: simple and available for people, with a small, specific locked path.
- Cached free/busy: fast lookups, and a short delay before a new event shows as busy.
What interviewers listen for
- A working answer: an events table with start and end, attendees, a range query for views and a reminder job.
- A strong answer: stores recurrence as a rule with exceptions, stores time zones as IANA IDs, indexes occurrences for fast range reads and prevents room double-booking at the database.
- A standout answer: handles "this and following" by splitting the series, treats daylight saving gaps and overlaps, caches free/busy as intervals, plans the 9:00 reminder burst and uses sync tokens.
Check your understanding
Common mistakes
Storing only UTC. It breaks recurring events across daylight saving changes and all-day events across zones. Keep local time and zone ID.
Materializing forever. Infinite recurrence cannot be stored as rows, and series edits become huge rewrites. Store a rule and a bounded window.
Expanding all rules on every read. The index cannot help, and heavy users pay for it every time. Keep a materialized window for range queries.
Locking everything. Blocking overlapping events for people makes the product worse and the system slower. Reserve strong consistency for rooms.
Check-then-insert for rooms. Two requests pass the check at once. Let the database reject the overlap.
Sending every reminder at the exact second. Plan for the bursts at round times, and process buckets ahead of time.
Practice
A company changes its main office from one time zone to another, and the calendar must show all recurring meetings at the right local time. A government also announces a surprise change to daylight saving rules in a country. What do you change in the system, and what do you do about events already stored?
Write your own answer first, on paper or in a note. Then compare.
Show a hint
Separate the data you stored from the rules used to interpret it. Think about which one changed.
Show a strong answer
Keep the stored fact: local time plus zone ID. The event still says "09:00 Monday, in zone Z." That fact did not change, so no event rows need editing.
Update the zone database. The government's change is new rules for zone Z. Ship an updated tz database as data to every service that expands occurrences. Because occurrences are derived from the rule and zone, they can be recomputed.
Rebuild the affected entries. Find series whose zone matches and whose future entries cross the changed dates, and re-run the expander for them. Do it as a background job in batches, because it touches only those series.
Tell clients. Bump the sync version for the affected calendars so devices fetch the corrected occurrences. Notify the attendees of occurrences whose UTC time moved, since the meeting time shifts for anyone in another zone.
The pattern worth keeping: store the intent (local time and zone), derive the instants and rebuild the derived data when the rules change.
The office asks for 'find a time that works for these 12 people next week' to be fast. Describe how you answer it, what you cache, and how you protect privacy.
Write your own answer first, on paper or in a note. Then compare.
Show a hint
Think about the shape of the data returned for each person, and what must stay hidden.
Show a strong answer
Return busy intervals, not events. For each person, free/busy is just a sorted list of (start, end) blocks. Keep these lists in a cache per user for the next few weeks, rebuilt on any change to their entries.
Merge in memory. Fetch 12 lists from the cache (12 small reads), merge them into one list of blocks where anyone is busy, and invert it into candidate free slots within working hours, filtered by each person's own working hours and zone. It is a sweep over sorted intervals, linear in the number of blocks.
Rank and return. Return the first few slots that fit the meeting length, optionally preferring times when the most people are free if no slot is free for everyone.
Protect privacy. The API returns only that someone is busy, not why. Honor calendar sharing settings: a person who shares nothing can still be shown as busy to people in their organization, depending on the policy you choose.
Handle misses. If a user's cache entry is missing, compute it from their entries and store it. A cold cache is slower but correct.
The pattern worth keeping: answer group questions from compact summaries (interval lists), never by scanning everyone's full data.
Key takeaways
- The scale is small, the model is the problem. 6,900 reads a second is easy, and recurrence and time zones are not.
- Store a recurrence rule with exceptions, and keep a rolling materialized index for range queries.
- Store local time plus an IANA zone ID for events. Derive UTC when you expand.
- Split a series for "this and following." It keeps history and the future independent.
- Use strong consistency only for room booking, via a database constraint, and keep people's events available.
- Cache free/busy as intervals, and process reminders in time buckets ahead of the minute.
Further reading
- B. Desruisseaux (editor), RFC 5545 "Internet Calendaring and Scheduling Core Object Specification (iCalendar)" (2009): the recurrence rule format and its exceptions.
- C. Daboo, B. Desruisseaux and L. Dusseault, RFC 4791 "Calendaring Extensions to WebDAV (CalDAV)" (2007): a standard protocol for calendar access and sync.
- IANA, Time Zone Database documentation: how zone rules and daylight saving transitions are maintained.
- PostgreSQL documentation, "Range Types" and "Exclusion Constraints": enforcing non-overlapping time ranges in the database.