Scale up, or scale out
Your system is getting slow because traffic grew. You have exactly two directions to grow in, and the entire industry has strong feelings about which one is "correct." Those feelings are often wrong, so let's look at what each choice actually costs.
Vertical scaling: buy a bigger machine
Scaling up means replacing your server with a beefier one — more CPU cores, more RAM, faster disks. It's like upgrading from a hatchback to a truck: same driver, same road, more capacity.
People underestimate how far this goes. A single modern server can have 128 CPU cores and 2 terabytes of RAM. A well-tuned Postgres database on that hardware serves tens of thousands of queries per second, comfortably, especially if the working data fits in memory. That covers the overwhelming majority of businesses that will ever exist — not startups only, real mid-sized companies.
And here's the beautiful part: vertical scaling costs you nothing in complexity. One machine means no distributed transactions, no replicas disagreeing with each other, no "which server has the truth?" debates. Your code stays simple. Simple code is code that works at 3am.
What it costs you: there's a ceiling (there is a biggest machine you can buy, and the biggest ones get disproportionately expensive), and it's a single point of failure — when that machine reboots for an update, your whole product is down.
Horizontal scaling: buy more machines
Scaling out means adding more machines and splitting the work among them. Instead of one truck, a fleet of hatchbacks. No ceiling — need more capacity, add more cars. One breaks down, the others keep driving.
But here's the fine print nobody reads: the moment you have two machines that both hold state (data that changes), you have inherited an entire field of computer science. What if the two copies disagree? What if the network between them hiccups? What if their clocks drift apart? These aren't rare edge cases — they're Tuesday. Tiers 4 and 6 of this course exist entirely because of this paragraph.
The crucial distinction: stateless things scale out for free; stateful things do not. App servers that just run code and hold no data? Clone them endlessly, trivial. Databases that hold your actual data? Every clone is a consistency problem you now own.
The order that actually works
When things get slow, walk this ladder from the top. Each rung is cheaper and more reversible than the one below it:
- Make the code faster. Find the N+1 query (fetching a list, then making one extra database call per item — the most common performance bug in existence). Fixing it is free and is usually a 10× win.
- Scale up the box. Boring, effective, reversible.
- Add a cache. Attack the read path before restructuring anything.
- Scale app servers out. They're stateless, so this is easy and safe.
- Add read replicas. Copies of the database that handle reads (Tier 4).
- Only now, shard the write path. Split the data itself across machines. Last resort, for reasons the trap explains.
Sharding on day one. Sharding is the most expensive, least reversible decision on that ladder — it permanently removes cross-shard joins and transactions from your toolbox (you'll feel this pain concretely in Tier 4). Teams reach for it years before they need it because it sounds like what "real" companies do, and then they pay interest on that complexity every single day. The boring ladder exists because it works.