Fundamentals
Free visual guideHLD Fundamentals

Six qualities that define every system

Latency, availability, consistency, durability, scalability, and throughput are not isolated vocabulary. They are the constraints you measure, trade, and defend in every system design.

00

Start with the right question

A fast system is not necessarily available. An available system is not necessarily consistent. Translate vague requirements into a number and a measurement window.

Latency

How long does one request take?

Availability

Can users reach the system?

Consistency

Do readers see the right data?

Durability

Will accepted data survive?

Scalability

Can capacity grow with demand?

Throughput

How much work finishes per second?

01

Latency

Latency is the elapsed time for one operation. Measure it from the user’s boundary—not only inside your service—and use percentiles to expose slow requests.

latency = response received time − request sent time
A 200 ms request, decomposed
200 ms total
18 msDNS + connection
32 msNetwork
45 msApplication
70 msDatabase
35 msResponse

The database is the largest slice, so optimizing DNS would barely move the total.

Average latency hides the tail
p50
120 ms
p95
310 ms
p99
780 ms
p99.9
1.8 s
02

Availability

Availability is the proportion of valid requests the system can serve successfully during a stated period. It includes planned and unplanned failure unless your contract says otherwise.

availability = successful requests ÷ valid requests × 100%
Availability target → annual downtime budget
99%
3 days 15 hrA hobby service
99.9%
8 hr 46 minA good internal tool
99.99%
52 min 34 secA mature customer service
99.999%
5 min 15 secCritical infrastructure

Two independent services with 99.9% availability called in sequence yield approximately 99.9% × 99.9% = 99.8%. Dependencies multiply risk. Redundancy, health checks, failover, timeouts, circuit breakers, and graceful degradation protect the request path.

03

Consistency

Consistency defines what a read may observe after writes occur. The right model is a product decision: bank balances and social-like counters have different correctness needs.

One write, two replicas, three possible reads
LeaderReplica AReplica Bprice = ₹499updated after 40 msupdated after 120 msstale read: ₹399fresh read: ₹499

Eventual consistency accepts a short stale-read window. Strong consistency delays or rejects the read until the latest write is visible.

Strong

A completed write is immediately visible to subsequent reads. Useful for inventory reservations and balances.

Eventual

Replicas converge if writes stop. Useful for feeds, analytics, view counts, and caches.

Session guarantees

A user sees their own writes while other users may briefly see older data. Often the practical middle ground.

04

Durability

Durability is the probability that acknowledged data remains recoverable. Replication handles hardware loss; backups and recovery procedures handle corruption, deletion, and wider disasters.

When is a write truly safe?
01

Client sends order

Request exists only in transit

02

Write-ahead log

Append reaches durable storage

03

Database commit

Transaction becomes visible

04

Replicated copy

Survives a machine or zone failure

05

Backup + restore test

Survives corruption or deletion

RPO

How much data can we lose?

Example: at most 5 minutes

RTO

How long can recovery take?

Example: restore within 30 minutes

Retention

How far back can we recover?

Example: 35 daily backups

05

Scalability

Scalability is the system’s ability to handle more load by adding resources while keeping service targets and cost within acceptable bounds.

Vertical and horizontal scaling compared

Scale up

vertical
8 CPU
32 GB RAM
64 CPU
256 GB RAM

Simple, but hardware has a ceiling and one machine remains a failure domain.

Scale out

horizontal
Node 1
Node 2
Node 3
Node 4

More capacity and resilience, but coordination, partitioning, and consistency become harder.

scaling efficiency = throughput gained ÷ resources added

If doubling servers raises throughput from 10,000 to only 13,000 requests/s, efficiency is 30%, not 100%. A shared database, lock, network link, or coordination step is probably limiting growth. Partition data and work only after identifying that bottleneck.

06

Throughput

Throughput is completed work per unit time: requests per second, transactions per second, events per second, or bytes per second. Count completed work, not merely accepted work.

A pipeline moves only as fast as its bottleneck
10k incoming
requests/s

API

8k req/s

Workers

5k jobs/s

Database

2k writes/s

The database caps completed throughput at 2,000 writes/s. The excess 8,000 requests queue, time out, or get rejected.
required concurrency ≈ throughput × average latency   (Little’s Law)

At 5,000 requests/s and 200 ms average latency, about 1,000 requests are concurrently in flight. Reducing latency can therefore increase throughput by releasing connections, threads, memory, and queue slots sooner.

07

Trade-offs, not trophies

No architecture maximizes all six qualities at once. Strong design explains which quality matters most, where the boundary sits, and how the decision is measured.

DecisionUsually improvesUsually costs
Add a cacheLatency ↓ Throughput ↑Consistency becomes harder
Synchronous replicationDurability ↑ Consistency ↑Write latency ↑ Availability may ↓
Async queuePeak throughput ↑ Availability ↑Freshness ↓ Operational complexity ↑
More replicasRead throughput ↑ Availability ↑Cost ↑ Replica lag appears
Batch writesThroughput ↑Per-item latency ↑

Payments

Prefer correctness and durability. Accept somewhat higher write latency. Use idempotency, a durable ledger, synchronous commit, and reconciliation.

Social feed

Prefer availability and read throughput. Accept brief staleness. Use caches, asynchronous fan-out, replicas, and graceful degradation.

08

An interview-ready answer

Use this sequence whenever an interviewer asks about a non-functional requirement.

  1. 01Name the quality precisely.
  2. 02Attach a target and measurement window.
  3. 03Estimate the expected and peak load.
  4. 04Choose mechanisms that protect the target.
  5. 05State the quality you traded away.
  6. 06Describe how you monitor and recover.

A concise example

“For checkout, I’ll target 99.99% availability and p99 latency below 500 ms. Payment writes require strong consistency and synchronous multi-zone durability. I’ll preserve availability for non-critical recommendations through timeouts and graceful degradation. The trade-off is higher payment latency and infrastructure cost, monitored through success rate, p99 latency, replication lag, and reconciliation errors.”

Continue learning

Explore every Fundamentals lesson

Open Fundamentals