The whole course ▾

System Design · Week 5 revision

Week 5 revision: Architecture

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

Architecture week in ten minutes: services, failures, sagas, IDs and observability, then six questions to test yourself.

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 20Splitting into services

Splitting into services
Mobile
app
API
gateway
Orders
service
Menus
service
Payments
service
one
address
/orders
/menus
/pay
SAY THIS IN THE INTERVIEW
Startwithamonolith;
splitbybusiness
capability,eachservice
owningitsdata.

This week, QuickBite stopped being one big app. It started with eighty engineers, all changing the same code.

Lesson twenty split the app by what the business does: an orders service, a menus service, a payments service, each owned by one team, deployed on its own, and owning its own database, which no other service reads. The mobile app talks to one API gateway, which routes by path, checks who you are once, and applies rate limits. Inside, services find each other through a registry or the platform's DNS, and they call each other when they need an answer now, or publish events when others just need to know.

The interview line: start with a monolith, and split by business capability when teams or scaling demand it, each service owning its data, behind an API gateway. Knowing when not to split is a senior signal.

Lesson 21When things fail

When things fail
Failure in three lines
1
Timeouts on every call
2
Retries: backoff, jitter, a cap
3
Breakers, bulkheads, fallbacks
SAY THIS IN THE INTERVIEW
Timeouts,cappedretries
withjitter,andacircuit
breakerandfallbackper
dependency.

Then, at eight in the evening, the payment provider got slow, and the whole app froze with it.

Lesson twenty-one, in three lines. Slow is worse than dead, so put timeouts on every call, just above the normal slowest answer. Retry only what's safe, with exponential backoff, jitter and a cap, at one layer only, or three layers of three retries become twenty-seven calls. And contain the damage: circuit breakers that fail fast, bulkheads that keep each dependency in its own pool, and fallbacks, like cash on delivery when online payments are down.

The interview line: timeouts on every call, capped retries with backoff and jitter where safe, and a circuit breaker and a fallback around every dependency. Then say what the user sees when it's down. And never retry a payment without an idempotency key, or the retry becomes a second charge.

Lesson 22Sagas

Sagas
Create order
undo: cancel
Charge card
undo: refund
Restaurant
accepts
then
then
refused:
refund
then
cancel
SAY THIS IN THE INTERVIEW
Asaga:localstepswith
compensatingactions,
runbyanorchestrator,
everystepidempotent.

Then the kitchen ran out of biryani, after the customer had already paid.

Lesson twenty-two: no transaction spans services. Two-phase commit could, but it holds locks while it waits, and blocks if the coordinator dies. So we used a saga. Create order, charge card, and the restaurant accepts: each a local transaction, and each with an undo written in advance. When the restaurant refused, the saga ran the undos backwards: refund, then cancel. An orchestrator runs the steps, and the hardest-to-undo step goes last.

The interview line: across services, a saga of local transactions with compensating steps, run by an orchestrator, every step idempotent, and the step that can't be undone placed last. Meanwhile, the customer sees an honest in-between state, like waiting for the restaurant.

Lessons 23 and 24IDs, and seeing inside

IDs, and seeing inside
Unique IDs
1
Auto-increment clashes across shards
2
UUIDs: easy, but big and unordered
3
Snowflake: time, machine, sequence
Observability
1
Metrics: what; traces: where; logs: why
2
One trace ID through every call
3
SLOs, budgets; alert on symptoms

And to finish the week, two tools every large system needs: names for things, and eyes inside.

Lesson twenty-three. Auto-increment clashes once you shard: two shards both made order five thousand and one. UUIDs need no coordination, but they're twice the size, and random ones scatter across indexes. Snowflake packs forty-one bits of time, ten of machine and twelve of sequence into sixty-four bits: unique without coordination, and sortable by time. And ticket servers, handing out blocks from one counter, are the classic alternative.

Lesson twenty-four. Metrics say something's wrong, traces say where, and logs say why. One trace ID, passed through every call and written into every log line, turned an hour of searching into a minute. And SLOs, with error budgets, decide when to ship and when to fix, while alerts fire on symptoms that users feel. Rate, errors and duration, for every service, are the three graphs to look at first.

What's nextNext week: patterns

Next week: patterns
Week 6: patterns
1
News feeds: fan-out
2
Search: inverted indexes
3
Finding what's nearby
4
Two people, one seat
5
Big files and long jobs

Next week is different. Each lesson is one pattern that shows up again and again in famous interview questions.

News feeds, and the celebrity problem. Search, and why LIKE pizza falls over. Finding riders nearby, with geohashes and cells. Two riders accepting the same order: two people, one seat. And big files and long jobs. Then on Sunday, everything comes together: design Uber. Each one is a tool you'll reach for in a dozen different designs.

Test yourself

Test yourself
?
Two services share one database.
What's the problem?
Every schema change by one team can break
the other: no independence.
?
A provider's p99 is 1 second. What
timeout would you set?
About 2 seconds: just above the normal
slowest, never 30.
?
Why add jitter to retries?
So clients that failed together don't all
retry at the same moment.
?
In a saga, which goes last: charging
the card, or the kitchen starting to
cook?
Cooking: it can't be undone, while a charge
can be refunded.
Test yourself (cont.)
?
Snowflake gives 10 bits to the
machine ID. How many generators can
run at once?
1,024: two to the power ten.
?
An alert fires whenever CPU passes
80%, though users are fine. Good
alert?
No: alert on symptoms users feel, like errors
and latency.
Quick check

Two services share one database. What's the problem?

Show the answer

Every schema change by one team can break the other: no independence.

Quick check

A provider's p99 is 1 second. What timeout would you set?

Show the answer

About 2 seconds: just above the normal slowest, never 30.

Quick check

Why add jitter to retries?

Show the answer

So clients that failed together don't all retry at the same moment.

Quick check

In a saga, which goes last: charging the card, or the kitchen starting to cook?

Show the answer

Cooking: it can't be undone, while a charge can be refunded.

Quick check

Snowflake gives 10 bits to the machine ID. How many generators can run at once?

Show the answer

1,024: two to the power ten.

Quick check

An alert fires whenever CPU passes 80%, though users are fine. Good alert?

Show the answer

No: alert on symptoms users feel, like errors and latency.

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.