</> MAANG.io

Expert

Design landmark systems in depth, from Dynamo, GFS, Bigtable and Kafka to payments and ads pipelines.

0 of 232 solved 0%

Section 8: One Edit, Fifty Thousand Calendars - Deep Dive: Invitations, Fan-Out & Sync

Executive Summary: Section 7 made Platform Sync correct on Priya's calendar; this section makes it correct everywhere else. We trace one edit from the outbox to fan-out workers, make out-of-order delivery harmless with per-event versions, and run RSVPs in reverse. Then come iMIP guests, the 50,000-member all-hands that flips to merge-on-read, sync tokens, coalesced tickles, and spam. The lesson to keep: copy data only when the copy count is bounded, and push signals, never payloads.

The interviewer taps the arrow from "Calendar Store" to "Fan-out Service." "That arrow is doing a lot of work. Priya moves Platform Sync. Walk me through how Tomás's phone finds out."

The Spine: Outbox, Stream, Fan-Out

You: "Priya's edit commits in one transaction on her partition: the canonical event row, a change-log row on her calendar, and an outbox row. That's the 300 ms acknowledgement. I never write to the queue from the API server: a dual write either loses fan-outs or fans out edits that rolled back. A relay tails the outbox into a change stream partitioned by the organizer's calendar_id, so every edit to ev_7f3k lands in one partition, in commit order."

Fan-out workers consume that stream. For each guest they write two rows on the guest's calendar partition: the denormalized ~1 KB attendee copy and a change-log entry. That's Section 3's ~104K/s of peak calendar writes, asynchronous on purpose: a synchronous fan-out can't fit a 1,000-guest edit into 300 ms, and pointer-and-join would turn each of the ~70K/s peak week views into a scatter across organizers' partitions.

Fan-out flow: Priya's edit is written in one transaction to the organizer partition and outbox, relayed onto a change stream by calendar_id to fan-out workers, which write a copy and log row to Tomás's and Ana's calendars and send iMIP email to external guests; the calendars feed a tickle coalescer that pushes via FCM / APNs to devices, which then sync with a token.

Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.