Scalability Fundamentals
Performance vs scalability, latency vs throughput, vertical vs horizontal scaling, stateless services, load balancing recap, autoscaling, Little's Law and queueing intuition, and the classic journey from a single server to millions of users.
Key definitions
| Term | Meaning |
|---|---|
| Performance | how fast the system is for a single user / request |
| Scalability | how capacity grows as you add resources (ideally linearly) |
| Latency | time per request (measure p50, p95, p99) |
| Throughput | requests completed per second |
| Availability | fraction of time the system serves requests successfully |
| Elasticity | adding/removing capacity automatically with demand |
A system has a performance problem if it's slow for one user, and a scalability problem if it's fast for one user but slow under load.
Vertical vs horizontal
| Vertical | Horizontal | |
|---|---|---|
| Effort | trivial | needs stateless design, LB |
| Limit | biggest machine | practically unlimited |
| Fault tolerance | none | built-in redundancy |
| Cost curve | super-linear at the top | roughly linear |
| Downtime to scale | often | none |
Statelessness
Queueing intuition: why 100% utilisation is a disaster
Little's Law: concurrency = throughput × latency. Use it to size pools and to understand cascading failures (latency up → in-flight requests up → pools exhausted).
Load balancing (recap)
L4 vs L7, algorithms, health checks: see Proxies, load balancers & CDNs. Key system-design points:
- Redundant load balancers (managed LBs are already redundant across AZs).
- Health checks + connection draining for safe deploys.
- Global load balancing (GeoDNS/anycast) for multi-region.
Autoscaling
| Type | Trigger | Notes |
|---|---|---|
| Reactive (target tracking) | CPU %, requests per instance, queue depth, concurrency | most common; lag of minutes |
| Scheduled | known daily/weekly peaks | pre-warm before events |
| Predictive | ML forecasts of traffic | smoother for regular patterns |
| Event-driven (KEDA) | queue length, Kafka lag | great for workers |
Pitfalls: scaling on CPU for I/O-bound services, slow instance start-up (pre-warmed pools, smaller images), databases that don't scale with the app tier (connection storms — use poolers like PgBouncer/RDS Proxy), and flapping (use cooldowns and scale-in protection).
From one server to millions of users
The AWS-flavoured evolution from the System Design Primer illustrates the path: DNS and CDN in front, load balancers, stateless web/app tiers split into read and write APIs, a memory cache, SQL primary with read replicas, object storage, a queue with workers for async writes, and eventually NoSQL, sharding and federation for the hottest data.

| Users | Typical architecture | Driven by |
|---|---|---|
| 1–1k | one server (app + DB), managed DB snapshot backups | simplicity |
| 1k–100k | separate DB, LB + 2+ app servers (multi-AZ), CDN for static | availability, static load |
| 100k–1M | Redis cache, read replicas, object storage, queues + workers, autoscaling | read load, slow tasks |
| 1M–10M | functional partitioning (separate DBs per domain), search engine, more caching, observability | write load, team growth |
| 10M+ | sharding, NoSQL for hot paths, multi-region, service decomposition, cell-based architecture | data size, global latency, blast radius |
Interview questions
Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.