A month ago, I told everyone:
"I've been a backend Engineer for 12+ years. Today, I'm a Principal Engineer at Atlassian.
I've designed systems that handle millions of requests. Sat on both sides of system design interviews.
Reviewed more architecture docs than I can count.
Starting today, I'm breaking down the fundamentals of scaling for the next 25 days.
If you're learning system design bookmark this thread, you're going to get a lot of learning from this."
FYI, the series has concluded. Here are all the concepts, please bookmark, share, learn and the most important build from the learnings you get.
Also, if you have any ideas on what you'd like to see from me, please let me know, any other series or concepts to be broken down.
Mock interview this week. Candidate could explain deadlocks, wait-for graphs, detection, all of it.
Then I asked:
"Two transactions deadlock in production a few times a day. You can't reproduce it locally. The code looks fine. What's the one structural change that makes it impossible?"
Silence.
That's the whole answer, and almost nobody says it.
You shard events by date.
It looks beautifully balanced in the design document.
In production, every event for today lands on the same partition.
Old partitions sit idle.
The key had high cardinality across history, but none in the present.
What would you shard by instead?
Interviewer:
In 2016, Uber moved its core data from Postgres to MySQL.
Instagram scaled to billions of users on Postgres.
Same database. Opposite decisions.
What did Uber see that Instagram didn't?
Their write patterns.
In Postgres, an UPDATE writes a new copy of the row. If the indexed columns or page layout change, every index on that table gets a new entry too. Uber updated rows constantly, on tables with many indexes, so one small update turned into many disk writes.
Postgres replicates those physical changes byte for byte. Uber was shipping all of that across data centres.
Instagram's core data is mostly inserts and reads: a photo, a like, a follow. Write once, read many times. That's the workload Postgres handles best.
Pick a database for your write pattern, not its reputation.
Mock interview last week.
Candidate designed a URL shortener perfectly. Base62 IDs, sharded database, Redis cache, the whole thing.
Then I asked:
"One of your short links is printed on a front-page newspaper ad. 2 crore people scan it in 10 minutes. Every request hits the same key."
Silence.
What would you say?
Interviewer grilling on CS Fundamentals:
HTTPS encrypts everything between your laptop and YouTube.
So how does your office firewall still know you're on YouTube, and block it?
"Let's add a cache here."
Interviewer: "How do you invalidate it?"
Candidate: "Let's add a TTL."
Interviewer: "User changes their password. The old one keeps working for 5 more minutes."
Candidate: "...let's add a queue."
Interviewer: ........................
$200 a day per engineer is โน3.5 lakh+ a month, just on AI tokens.
That's more than most engineers in India take home.
Every company will hit this wall soon.
The engineers who stand out will treat tokens like cloud spend:
โ cache repeated prompts
โ send only the context the task needs
โ route routine work to a cheaper model
โ track cost per merged PR instead of cost per token
Spending more on AI is easy. Getting the same output for $40 a day is the skill.
NEW: Apple is cutting employee AI spending budgets even as it pushes workers to use the technology more. Engineers have seen daily limits cut from $300 to $200, with further reductions to $100 planned. Other teams could see limits fall to $25. https://t.co/4tnOIaxpDz