Handling more users and more data by adding resources, without breaking.
Scalability means a system can handle more users, more requests and more data without becoming slow or breaking.
Scalability is the ability of a system to handle a growing amount of work by adding resources, while still working fast and staying reliable.
| Word | Simple meaning | Question it answers |
|---|---|---|
| Performance | How fast it is for one user | Is it fast right now? |
| Scalability | How well it stays fast when users grow | Will it stay fast with 1000x users? |
| Availability | How much of the time it is up | Is it working when I need it? |
| Reliability | Correct results without failing | Can I trust it? |
We need it because traffic never stays the same. It grows over time, and it also jumps suddenly.
Any system that can grow needs scalability.
There are two main ways to scale: make one machine bigger, or use more machines.
| Point | Vertical (up) | Horizontal (out) |
|---|---|---|
| What it means | More CPU, RAM, disk in one machine | More machines |
| Easy to do? | Yes, very simple | Harder, needs design changes |
| Code changes | Usually none | Often yes (servers should be stateless) |
| Limit | Hardware limit, very costly at the top | Almost no limit |
| If one machine fails | Everything stops (SPOF) | Others keep working |
| Downtime while scaling | Often needs a restart | Usually none |
| Needs load balancer? | No | Yes |
| Best for | Small apps, early databases | Big systems, web servers |
| Technique | What it does in simple words |
|---|---|
| Load balancer | Spreads requests across many servers |
| Stateless servers | Servers do not remember the user, so any server can serve any request |
| Caching | Keeps popular data in fast memory so the database is not hit every time |
| CDN | Keeps copies of images and videos close to the user |
| Replication | Copies of the database handle read requests |
| Sharding | Splits big data across many databases |
| Message queues | Slow jobs run in the background so users do not wait |
| Auto-scaling | Adds or removes servers by itself |
| Term | Meaning in easy words |
|---|---|
| Load | The amount of work on the system (users, requests, data) |
| Throughput | How many requests the system handles per second (RPS or QPS) |
| Latency | How long one request takes to get a reply |
| p99 latency | The time within which 99 out of 100 requests finish. Shows the slow cases |
| Capacity | The maximum load the system can handle today |
| Bottleneck | The slowest part that limits the whole system (often the database) |
| Stateless | Server keeps no user memory between requests. Easy to scale |
| Stateful | Server remembers user data (like a login). Harder to scale |
| Elasticity | Growing AND shrinking automatically with load |
| SPOF | Single point of failure: one part whose failure stops everything |
| Load testing | Testing with fake heavy traffic to find the limit |
| Choice | We gain | We lose |
|---|---|---|
| Vertical scaling | Simple, quick | Hardware limit, SPOF |
| Horizontal scaling | Almost unlimited growth, fault tolerance | Complex design, load balancer needed |
| Caching | Very fast reads | Data may be stale |
| Replication | More read capacity, backup | Copies may lag behind |
| Sharding | Store huge data | Complex queries, hard to rebalance |
| Async with queues | Users do not wait | Result is not instant |