Skip to content
Chethan Yadav_
System Design

SD/Lesson 1 of 8/5 min read

System Design Fundamentals

How to approach a design interview, functional vs non-functional requirements, scalability, availability and the nines, latency numbers, and back-of-the-envelope estimation.


On this page

System Design

System design is choosing components, data flows and trade-offs so a system meets its requirements at the scale it will actually face. There is rarely one right answer; interviewers grade how you reason about trade-offs.

A framework for design interviews

  1. Clarify requirements (5 min). Who uses it, what features, what scale.
  2. Estimate scale (5 min). Users, requests per second, storage, bandwidth.
  3. Define the API (5 min). The handful of endpoints that matter.
  4. High-level design (10 min). Boxes and arrows: clients, load balancer, services, storage, caches, queues.
  5. Deep dive (15 min). The hardest one or two components: data model, sharding, consistency, hotspots.
  6. Wrap up (5 min). Bottlenecks, failure modes, monitoring, what you would do next.
Do not jump to drawing boxes. Ten minutes on requirements and numbers usually decides whether the design needs a single Postgres box or a sharded cluster.

Requirements

Functional requirements

What the system does: "users can shorten a URL", "users see a feed of people they follow".

Non-Functional Requirements

How well it does it:

QualityQuestion to ask
ScalabilityHow many users, how fast is it growing?
AvailabilityHow much downtime is acceptable?
LatencyWhat response time do users expect (p50, p99)?
ConsistencyIs stale data acceptable, and for how long?
DurabilityCan we ever lose data?
CostIs this a startup or a hyperscaler budget?

Non-functional requirements drive almost every architectural decision.

Scalability

Scalability is the ability to handle more load by adding resources.

Vertical Scaling

Scale up: a bigger machine (more CPU, RAM, faster disk).

  • Simple, no code changes, no distributed-systems problems.
  • Hard ceiling on hardware size, expensive at the top end, still a single point of failure.

Horizontal Scaling

Scale out: more machines behind a load balancer.

  • Near-linear capacity growth, commodity hardware, redundancy for free.
  • Requires stateless services, data partitioning, and dealing with network failures.

Stateless Service

A stateless service keeps no per-user data in memory between requests. Session data lives in a shared store (Redis, a database, or a signed token). Any instance can handle any request, so instances can be added, removed or restarted freely. Making the web tier stateless is the first step to horizontal scaling.

Availability

Availability is the fraction of time a system is operational.

AvailabilityDowntime per yearDowntime per month
99% (two nines)3.65 days7.3 hours
99.9% (three nines)8.77 hours43.8 minutes
99.99% (four nines)52.6 minutes4.38 minutes
99.999% (five nines)5.26 minutes26.3 seconds

Components in series multiply: two 99.9% services in a chain give 99.8%. Components in parallel (redundant) improve it: two independent 99.9% replicas give 1 - 0.001² = 99.9999%.

Single Point of Failure

A single point of failure (SPOF) is any component whose failure takes the whole system down: one database, one load balancer, one region. Remove SPOFs with redundancy (replicas, active-passive or active-active pairs) and failover.

SLA, SLO, SLI

  • SLI (indicator): a measured metric, such as the percentage of requests served under 200 ms.
  • SLO (objective): the internal target for an SLI, such as 99.9% of requests under 200 ms.
  • SLA (agreement): a contract with customers, with penalties if missed. SLAs are looser than SLOs.

The gap between 100% and the SLO is the error budget: how much failure you can spend on risky deploys.

Latency and throughput

  • Latency: time to serve one request. Report percentiles (p50, p95, p99), not averages; tail latency hurts the most users at scale.
  • Throughput: requests served per unit time.

Latency numbers every engineer should know

OperationApproximate time
L1 cache reference1 ns
Main memory reference100 ns
Compress 1 KB2 µs
Read 1 MB sequentially from memory3 µs
SSD random read16 µs
Round trip within a datacenter500 µs
Read 1 MB sequentially from SSD50 µs to 1 ms
HDD seek2 to 10 ms
Round trip US to Europe150 ms

Takeaways: memory is about 100x faster than SSD, network hops inside a datacenter are cheap compared with cross-continent trips, and disk seeks are the slowest thing you will normally do.

Back-of-the-Envelope Estimation

Rough numbers that decide architecture. Useful constants:

  • 1 day ≈ 86,400 s ≈ 10⁵ s.
  • 1 million requests per day ≈ 12 requests per second.
  • Peak traffic ≈ 2x to 3x average.
  • 1 KB × 1 billion = 1 TB.

Example: a service with 100 M daily active users, each making 10 reads and 1 write per day.

Reads:  100M × 10 / 10^5 s  ≈ 10,000 QPS  (peak ≈ 30,000)
Writes: 100M × 1  / 10^5 s  ≈  1,000 QPS
Storage: 100M writes/day × 1 KB = 100 GB/day ≈ 36 TB/year

Conclusion: reads dominate (10:1), so add caches and read replicas; 36 TB per year needs sharding or object storage.

Quick revision

  • Clarify requirements, estimate, define API, draw high level, deep dive, discuss bottlenecks.
  • Non-functional requirements (scale, availability, latency, consistency) drive the design.
  • Vertical scaling is simple but capped; horizontal scaling needs stateless services.
  • Availability nines: 99.9% is about 8.8 hours of downtime per year; redundancy removes SPOFs.
  • Use percentiles for latency; memory is ~100x faster than SSD; cross-continent RTT is ~150 ms.
  • 1 M requests per day ≈ 12 QPS; 1 day ≈ 10⁵ seconds.