The whole course ▾

System Design · Week 8 revision

Week 8 revision: Senior level

Updated 22 Oct 2026 · By Akshay, software engineer, India · 4 min read

Senior week in ten minutes: Docs, schedulers, streams, regions and senior habits, then six questions.

The video for this revision is coming soon.

New System Design videos go up at 6 pm. Subscribe on YouTube so you don't miss it.

Got a doubt? Ask in the comments under the video.Subscribe

Lesson 35Google Docs

Google Docs
Editors'
browsers
Load
balancer
by doc ID
Session
server
orders the edits
Edit log
Snapshots
WebSocket
doc 42
append
first
every few
hundred
SAY THIS IN THE INTERVIEW
OToraCRDT,one
sessionserverper
document,aneditlog
andsnapshots.

The last week of lessons was the hardest. It started with three people typing into the same sentence.

Lesson thirty-five. Concurrent edits are made against older versions, so their positions must be adjusted: Ana's s moved from position three to seven. Editors' browsers keep WebSockets open, and a load balancer routes every editor of one document to the same session server, which orders the edits with operational transformation, or merges them with a CRDT. Each edit is appended to the edit log before it's broadcast, and snapshots make loading fast. Cursors are sent live, and never stored.

The interview line: operational transformation with a central server, or a CRDT for offline-first; one session server per document; edits logged before they're acknowledged; snapshots for loading and version history; and presence as throwaway data.

Lesson 36The job scheduler

The job scheduler
The scheduler in three lines
1
Jobs and runs, indexed by start time
2
Claim with a conditional write and a lease
3
At least once: idempotent jobs
SAY THIS IN THE INTERVIEW
Runsclaimedwithleases,
idempotentjobs,
prioritiesandquotas,and
jitterformidnight.

Then cron, for a whole company, after one machine's failure left the restaurants unpaid.

Lesson thirty-six, in three lines. Job definitions and individual runs live in a database, with runs indexed by their start time, so finding what's due is one quick query. Workers claim a run with a conditional write and a lease, extended by heartbeats, so a dead worker's run returns to pending. And because a paused worker can outlive its lease, runs happen at least once, so jobs are idempotent, with fencing tokens.

The interview line: runs claimed with a lease and heartbeats, idempotent jobs, priorities and per-team quotas, retries into dead letters, and jitter to spread the midnight spike.

Lesson 37Stream processing

Stream processing
Streams in three lines
1
Keep the events; count the stream
2
Windows by event time, with watermarks
3
Checkpoints, idempotent output, nightly recount
SAY THIS IN THE INTERVIEW
Kafka,windowsbyevent
time,watermarks,
checkpoints,andanightly
recountforbilling.

Then QuickBite sold ads, and every click became money.

Lesson thirty-seven. Never add one to a database row per click: keep every click as an event in Kafka, and count the stream with a processor like Flink, in one-minute windows. Count by when each click happened, using watermarks to wait for late clicks. And checkpoints, saving counters and Kafka offsets together, plus idempotent output, give exactly-once counts, while a nightly recount from raw events produces the billing numbers.

The interview line: click events into Kafka, partitioned by ad; a stream processor counting tumbling windows by event time, with watermarks and checkpoints; idempotent writes to a counts store; and a nightly batch recount for anything that's billed.

Lessons 38 and 39Regions, and senior habits

Regions, and senior habits
Multi-region
1
Speed, survival and the law
2
A home region per user: one writer
3
Geo DNS, async copies, practised failover
Senior habits
1
Requirements first; numbers that decide
2
We gain, we give up, and why it's fine
3
Depth where it matters; simple wins

And to finish: QuickBite went abroad, and then we looked at the whole course on one board.

Lesson thirty-eight. Regions are for speed, survival, and laws that keep data in-country. Give every customer a home region, so each record has exactly one writer and regions never conflict. Send users to the nearest healthy region with geo DNS, copy data asynchronously, accepting a few seconds of possible loss, and practise failover, because an untested one is only a hope.

Lesson thirty-nine. Requirements before boxes, and only numbers that decide something. Every trade-off said in one shape: we gain this, we give up that, and that's acceptable because of this. Depth on the hardest part, not on every box. And the simple system that meets the requirements wins, because every extra box is a cost you pay every day.

What's nextThe final mock, and beyond

The final mock, and beyond
Twelve more mock interviews
->
Yelp: places near you
->
A distributed cache
->
Spotify, and an online judge
->
Live streaming, Google Maps, a stock exchange
->
…and finally, ChatGPT

Tomorrow is the final mock interview of the course, and it's the one we've been building towards since lesson one: design QuickBite itself. After that, the mock interviews keep coming.

Twelve more mock interviews follow, every Sunday and Wednesday. Yelp, and places near you. A distributed cache. Spotify, and an online coding judge. Live comments and live video for fifty million viewers, a train booking rush, Google Maps, a stock exchange, hotel booking, and a metrics system. And finally, serving ChatGPT itself.

Test yourself

Test yourself
?
Why can't a shared document be
saved with last write wins?
Each save would erase other people's
typing: edits must be merged, not replaced.
?
A worker's lease runs out while it's
still running a job. What can happen?
Another worker claims it and runs it too: a
duplicate run.
?
In stream processing, what is a
watermark?
An estimate that all events up to a certain
time have arrived; windows close behind it.
?
Why recount ad clicks every night if
the stream already counts them?
Billing needs exact numbers: dedupe, remove
bots, and catch what the stream missed.
Test yourself (cont.)
?
Why not copy data between regions
synchronously?
Every write would wait for a round trip to
the far region.
?
What two things should every box on
your diagram have?
A reason it's there, and a cost you can
name.
Quick check

Why can't a shared document be saved with last write wins?

Show the answer

Each save would erase other people's typing: edits must be merged, not replaced.

Quick check

A worker's lease runs out while it's still running a job. What can happen?

Show the answer

Another worker claims it and runs it too: a duplicate run.

Quick check

In stream processing, what is a watermark?

Show the answer

An estimate that all events up to a certain time have arrived; windows close behind it.

Quick check

Why recount ad clicks every night if the stream already counts them?

Show the answer

Billing needs exact numbers: dedupe, remove bots, and catch what the stream missed.

Quick check

Why not copy data between regions synchronously?

Show the answer

Every write would wait for a round trip to the far region.

Quick check

What two things should every box on your diagram have?

Show the answer

A reason it's there, and a cost you can name.

Practise with flashcardsYour progress stays on this device.
New System Design videos at 6 pm

Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.