Skip to content

Cheat Sheet and Glossary

Basic 65 min read Part 16 of 18

A one-page cheat sheet (requirements checklist, estimation formulas, component and pattern pickers) plus a linked glossary of system design terms.

Summary#

This page is the handbook folded onto one sheet, plus a dictionary. Use it the night before an interview, or whenever you start a real design and want to be sure nothing obvious is missing.

  • The cheat sheet has four parts:
    • Requirements checklist: the questions that turn a vague prompt into a scoped problem.
    • Estimation formulas: QPS, storage, bandwidth, servers, cache size and availability, with the modern hardware numbers that keep them honest.
    • Component picker: which building block answers which need.
    • Pattern picker: which of the seven recurring patterns a problem signal points to.
  • The glossary defines a few hundred core terms in one or two plain sentences each, grouped by topic. Every term links to the page that teaches it in depth.
  • The main trade-off is speed for depth. A cheat sheet tells you what to reach for. The linked pages tell you why, when not, and how it fails. Use this page to find your way, not as a substitute for understanding.

Why It Exists#

System design has a vocabulary problem and a recall problem.

  • The vocabulary problem. The field uses hundreds of terms, and many sound alike but mean different things:

    • "Consistency" means one thing in ACID and another in CAP.
    • "Partition" can mean a network split or a slice of data.
    • "Exactly-once" rarely means what it sounds like.

    A beginner reading a design doc or an interviewer's question can lose the thread on a single unfamiliar word.

  • The recall problem. Under time pressure, people forget the obvious: to ask about read/write ratio, to estimate peak rather than average traffic, to mention what happens when the cache is cold. Experienced engineers don't hold everything in their heads. They use checklists, compact lists of things to verify, so that working memory is free for the hard, problem-specific thinking.

  • Stale numbers. Hardware moves fast. Numbers that were true a decade ago (split your database at 100 GB, keep objects small in memory, a server tops out at a few GB of RAM) are off by orders of magnitude today. A candidate who estimates with 2015 hardware ends up proposing sharding and caching layers a single modern machine doesn't need. A cheat sheet with current numbers prevents that.

How It Works#

The cheat sheet follows the order of a design session. Each block feeds the next: requirements give you numbers, numbers decide which components are needed, and components plus the problem's shape point to patterns. The glossary sits beside all of it.

Requirements checklist#

Ask these before drawing anything (Requirements Gathering: From Problem Statement to Scope). In an interview, spend about 5 minutes here and write the answers on the board. Interviewers judge how well you scope, not how fast you draw.

Functional requirements: what the system does.

  • Core actions. Who are the actors (users, admins, other services), and what are the 3–5 actions that matter most? Phrase them as "users can …": post a photo, follow a user, see a feed. Everything else goes into "out of scope", stated explicitly.
  • Read and write paths. For each action, which data is written, and which reads happen right after?
  • Ordering, history and search. Is ordering needed (chat messages, bids)? Is history needed (edits, audit trail)? Is search needed (by text, by location, by time)?
  • Notifications and realtime. Does anyone need to be told when something changes? Push, email, or in-app?

Non-functional requirements: how well it does it (Non-Functional Requirements and How They Drive Design):

  • Scale. Daily active users (DAU), actions per user per day, peak-to-average ratio, data size per item, retention period, growth per year.
  • Read/write ratio. Feeds and URL shorteners are read-heavy, often 100:1 or more. Logging, metrics and IoT ingest are write-heavy. This one number decides more architecture than almost any other.
  • Latency targets. Pin them as percentiles: "p99 feed load under 200 ms", "message delivered within 1 s". Say which paths are user-facing and which can be asynchronous (Latency, Throughput and Performance vs Scalability).
  • Consistency. Where must reads see the latest write (balances, inventory, bookings)? Where is a few seconds of staleness fine (likes, view counts, feeds)? (Consistency Models, CAP Theorem and PACELC).
  • Availability. What does an outage cost? Three nines (99.9%) allows about 43 minutes of downtime a month, four nines about 4.3 minutes (Availability, Reliability and Fault Tolerance).
  • Durability. Can any data ever be lost? A payment or a message, never. A typing indicator or a cursor position, yes.
  • Security and compliance. Authentication, authorization, PII, regional data residency, audit (Security Fundamentals for System Design).
  • Cost and team constraints. Budget, existing stack, team size. "Use what the team can operate" is a legitimate requirement.

Defaults when the interviewer says "you decide":

  • Users and traffic. Assume about 100 million DAU for a consumer app or 10 million for a niche one, and a peak factor of 2–3× the daily average (higher for event-driven products like ticketing).
  • Availability and consistency. Assume high availability with eventual consistency, except for money, inventory and identity, which get strong consistency.
  • Latency. Aim for under about 200 ms p99 on reads and under about 500 ms on writes. Background work can take seconds to minutes.
  • Retention. Keep data for 5 years unless told otherwise. Media is stored once and served via a CDN.

Estimation formulas#

Estimation exists to make decisions, not to produce precise numbers (Back-of-the-Envelope Estimation). Round aggressively, keep powers of ten, and after each number say what it means for the design: "about 12,000 writes per second, more than one Postgres primary comfortably handles for this row size, so we'll partition."

Time and traffic:

  • One day is about 86,400 seconds; round it to 10⁵. So 1 million requests a day is about 12 per second, and 1 billion a day is about 12,000 per second.
  • Average QPS = DAU × actions per user per day ÷ 86,400. For example, 100 M DAU × 10 reads ÷ 10⁵ ≈ 10,000 reads/s.
  • Peak QPS = average × peak factor. Use 2–3× for normal diurnal traffic and 10× or more for flash sales, ticket drops and live events. Design for peak, and say so.
  • Read QPS = write QPS × read/write ratio. Writes usually dictate the database choice; reads dictate caching and replicas.

Storage:

  • Storage per day = writes per day × bytes per write.
  • Total storage = per day × 365 × years × replication factor, plus index overhead (often +20–50% for secondary indexes).
  • Worked example. 100 M posts a day at 1 KB each is 100 GB/day, about 36 TB/year, or about 110 TB with 3× replication. Media is separate: 10 M photos a day at 2 MB is 20 TB/day in object storage.

Bandwidth:

  • Ingress = write QPS × request size. Egress = read QPS × response size.
  • Worked example. 10,000 reads/s × 100 KB is 1 GB/s, about 8 Gbps: one modern NIC, but a lot of egress cost. That's why media goes through a CDN (Content Delivery Networks (CDN)).

Servers:

  • Servers = peak QPS ÷ QPS per server, × headroom (about 1.5–2×) for failures and deploys.
  • Concurrency (Little's law): concurrent requests in flight = arrival rate × time in system. 10,000 req/s × 50 ms = 500 concurrent requests. That sizes thread pools, connection pools and in-flight limits.

Cache:

  • Cache size ≈ hot fraction × total working data. The 80/20 rule says ~20% of items serve ~80% of reads, so caching 20% of a day's read set is a common starting estimate (Caching Fundamentals).
  • Hit ratio drives database load. Database read QPS = total read QPS × (1 − hit ratio). Going from 90% to 99% hits cuts database reads 10×.

Availability:

  • Downtime budget = (1 − availability) × period. 99.9% is about 8.8 hours/year (43 min/month), 99.99% is about 53 min/year (4.3 min/month), and 99.999% is about 5.3 min/year.
  • Components in series multiply. Three 99.9% services in a chain give 0.999³ ≈ 99.7%.
  • Redundant replicas in parallel: 1 − (1 − a)ⁿ. Two independent 99% replicas give 99.99%, assuming failures really are independent (they often aren't).

Data sizes worth memorising:

ThingApproximate size
UUID / 128-bit ID16 bytes (36 as text)
64-bit ID, timestamp8 bytes
Short text post or chat message with metadata0.5–1 KB
JSON API response for a list page10–100 KB
Compressed photo200 KB – 2 MB
One minute of 1080p videoabout 50–100 MB
Powers of two2¹⁰ ≈ 1 thousand (KB), 2²⁰ ≈ 1 million (MB), 2³⁰ ≈ 1 billion (GB), 2⁴⁰ ≈ 1 trillion (TB)

Numbers to know: latency and modern hardware#

These are approximate, order-of-magnitude numbers for current cloud hardware (Numbers Every Engineer Should Know).

Latency:

OperationApproximate time
L1 cache / main memory referenceabout 1 ns / about 100 ns
Read 1 MB sequentially from memoryabout 10–50 µs
SSD random readabout 100 µs (NVMe: tens of µs)
Round trip within one availability zoneunder 1 ms
Round trip across zones in a regionabout 1–2 ms
Redis GET over the networkabout 0.2–1 ms
Indexed lookup in a relational database (warm cache)about 1–5 ms
Cross-region round tripabout 50–150 ms
Object storage first byte (standard tier)about 30–100 ms

Hardware (single machine, current cloud generation):

  • Compute. General-purpose instances reach about 128 vCPUs and 512 GiB of RAM, such as AWS's M6i.32xlarge.
  • Memory. Memory-optimised instances reach 4 TB (X1e.32xlarge) and 24 TB of RAM (U-24tb1.metal).
  • Storage. Local SSD reaches about 60 TB on one instance (i3en.24xlarge), and dense HDD about 336 TB (D3en.12xlarge). Object storage like S3 is effectively unlimited; petabytes are routine.
  • Network. About 25 Gbps is common, and high-performance instances get 50–100 Gbps or more. Bandwidth between availability zones is limited only by the instance's own network capacity.

What one component can do (order of magnitude, varies with payload and hardware):

ComponentRough single-node capacity
Stateless app server (simple JSON API)about 1,000–10,000+ requests/s
Relational database (PostgreSQL/MySQL) primaryabout 10,000+ simple transactions/s; tables of several TB are routine
Redis nodeabout 100,000+ simple ops/s, sub-ms latency; memory-bound, not CPU-bound
Kafka brokerhundreds of MB/s of writes; hundreds of thousands of small messages/s
WebSocket gateway hosttens of thousands to hundreds of thousands of idle connections, memory-bound
Object storageeffectively unlimited capacity and aggregate throughput; per-prefix request limits apply

Estimation mistakes that make designs worse:

  • Premature sharding. A single modern database with replicas handles far more than most interview prompts need. Many tables that "must be sharded" are a few TB and fit on one machine. Shard when the numbers demand it (write throughput or working-set size beyond one primary), and say which number made you do it (Partitioning and Sharding).
  • Overestimating latency. Same-zone network hops are well under a millisecond, and indexed reads take single-digit milliseconds. A design that adds a cache to avoid a 2 ms query, or rules out a service call because "the network is slow", is solving a problem that doesn't exist. Cross-region hops (50–150 ms) are the latency that really matters.
  • Over-engineering for write throughput. "10,000 writes per second" sounds big, but it's a load modern databases and Kafka handle routinely. Reach for queues, write-behind caches and sharding only after estimating peak writes and comparing them to what one node does (Pattern: Scaling Writes).
  • Forgetting cost. Memory costs much more per GB than SSD, which costs more than object storage. Cross-region and internet egress is often the line item that surprises people. Use cheaper tiers for cold data (Data Lifecycle, Tiering and Retention), and put a CDN in front of heavy media (Cloud Architecture Essentials).

Component picker#

Each building block answers one recurring need. Start with the simplest stack (clients → load balancer → stateless app servers → one relational database). Add a component only when a requirement or a number calls for it, and say which one (Scaling from Zero to Millions of Users).

NeedReach forSignal that you need it
Spread traffic across servers, survive a server lossLoad balancerMore than one app server; any availability target
One front door: auth, rate limits, routingAPI gatewayMany services or clients; per-client policies
Serve static files and media close to usersCDNGlobal users; images, video, JS bundles; heavy egress
Durable, queryable records with relationships and transactionsRelational databaseThe default; money, inventory, users, orders
Huge write volume, simple key access, horizontal scaleNoSQL / wide-column / key-valueSustained writes beyond one primary; known access patterns
Fast repeated reads, sessions, counters, leaderboardsCache (Redis/Memcached)Read-heavy; p99 targets; hot keys
Large blobs: photos, video, backups, filesObject storageAnything over about 1 MB; files uploaded by users
Full-text search, relevance, facetsSearch index (Elasticsearch/OpenSearch)Search by words, fuzzy match, ranking
Decouple producers from slow work, absorb burstsMessage queueWork that takes over about 1 s; spiky load; retries
Many consumers of the same events, replayEvent stream (Kafka)Fan-out to several systems; audit; reprocessing
Push updates to clientsWebSockets / SSEChat, live scores, collaboration, notifications in-app
Location queriesGeospatial index"Near me", drivers, delivery radius
Similarity search on embeddingsVector databaseSemantic search, recommendations, RAG
Time-stamped metrics and eventsTime-series databaseMonitoring, IoT, append-heavy time-window queries
Multi-step business processes that must finishWorkflow engine (Temporal)Steps across services, long waits, compensation
Unique IDs without coordinationID generator (Snowflake-style)Sharded data; sortable IDs; high insert rate
One leader, config, membershipCoordination service (ZooKeeper/etcd)Leader election, locks, service discovery

Database picker in one breath (Choosing a Database: A Decision Guide):

  • Default to PostgreSQL for transactional data; it handles far more than people expect.
  • DynamoDB or Cassandra for very high write volume with known key-based access patterns.
  • Redis for sub-millisecond reads, counters and ephemeral state.
  • Elasticsearch for text search, fed from the primary database.
  • Object storage for anything blob-shaped.
  • A time-series database for metrics.
  • A graph database only when multi-hop traversals are the core query.
  • A vector database for embedding search.

Keep one source of truth per fact and feed derived stores from it, usually through change data capture (Change Data Capture and the Outbox Pattern).

Pattern picker#

Most interview problems are a known pattern in disguise (Choosing the Right Pattern). Spot the signal in the requirements and you know which deep dive the interviewer is waiting for.

Signal in the promptPatternCore techniques
"Millions of users view…", read/write ratio of 100:1 or morePattern: Scaling ReadsIndexes, read replicas, caches, CDN, denormalised read models, request coalescing
"Ingest events / likes / clicks / metrics at high rate"Pattern: Scaling WritesSharding by key, batching, write-ahead logs and queues, LSM stores, pre-aggregation
"Users see changes live"Pattern: Pushing Realtime UpdatesWebSockets/SSE, pub/sub fan-out, connection gateways, presence
"Generate a report / transcode a video / run a job"Pattern: Managing Long-Running TasksQueue plus workers, job status table, retries, dead-letter queues, progress polling
"Book a seat / buy limited stock / bid"Pattern: Dealing with ContentionRow locks, optimistic concurrency, reservations with expiry, queues for the hot item
"Order → payment → shipping, across services"Pattern: Multi-Step Processes and WorkflowsSagas, outbox, workflow engines, idempotency keys, compensation
"Upload / download large files"Pattern: Handling Large Files and BlobsPre-signed URLs, multipart and resumable uploads, CDN, async processing

Most real problems combine two or three patterns. A ticketing system is Contention (seats) plus Scaling Reads (event pages) plus often Realtime Updates (the seat map). Name the dominant one first.

How to use the glossary#

Terms are grouped by the handbook's parts, so related ideas sit together and you can learn a whole area in one pass. Within each group they're alphabetical. Every term links to the page that explains it properly, with diagrams, trade-offs and failure modes. Search (Ctrl/Cmd+K) finds any term instantly. Where two terms are commonly confused, the definition says so, and the first deep dive below collects the worst offenders.

Glossary: foundations, requirements and estimation#

  • Availability: the fraction of time a system answers requests correctly, usually written in "nines". 99.9% allows about 43 minutes of downtime a month. Not the same as durability: a system can be down yet lose no data.
  • Back-of-the-envelope estimation: quick, rounded arithmetic (QPS, storage, bandwidth, servers) used to decide whether a design needs a given component. Precision doesn't matter; orders of magnitude do.
  • BASE: "basically available, soft state, eventually consistent". It describes many NoSQL systems that favour availability and accept temporary disagreement between replicas. It's the loose counterpart to ACID.
  • CAP theorem: during a network partition, a replicated system must choose between consistency (every read sees the latest write) and availability (every request gets an answer). Without a partition, you can have both.
  • Causal consistency: if one event could have influenced another (a reply to a comment), every observer sees them in that order. Unrelated events may appear in different orders to different observers.
  • Durability: once a write is acknowledged, it survives crashes, power loss and disk failure. It's achieved with logs, replication and backups.
  • Eventual consistency: if writes stop, all replicas eventually converge to the same value. Until then, reads may return stale data. It's the cheapest, most available model.
  • Fault tolerance: continuing to operate correctly while some components fail, usually through redundancy. High availability is about minimising downtime; fault tolerance aims for no visible failure at all.
  • Functional requirement: something the system must do, phrased as a user action: "users can send a message". The core three to five define the scope of a design.
  • Horizontal scaling (scaling out): adding more machines and spreading the load across them. It needs stateless services or partitioned data, but has no hard ceiling.
  • Latency: the time one request takes from start to finish. Report it as percentiles (p50, p99), never just an average, because averages hide the slow tail users actually feel.
  • Linearizability: the strongest single-object guarantee. Every operation appears to take effect at one instant between its start and end, so once any client sees a write, all later reads see it too.
  • Little's law: items in a system = arrival rate × time each spends inside. At 1,000 requests/s and 200 ms each, about 200 requests are in flight. It sizes pools, queues and concurrency limits.
  • Monotonic reads: once a client has seen a value, it never later sees an older one. It prevents the confusing "comment appears, then disappears" effect when reads bounce between replicas.
  • MTBF and MTTR: mean time between failures and mean time to recovery. Availability ≈ MTBF ÷ (MTBF + MTTR), so faster recovery raises availability as much as rarer failures do.
  • Nines: shorthand for availability. Three nines (99.9%) allows about 8.8 hours of downtime a year, four nines about 53 minutes, five nines about 5 minutes.
  • Non-functional requirement: a quality the system must have, such as scale, latency, availability, consistency, durability, security or cost. These drive architecture far more than features do.
  • PACELC: an extension of CAP. If there's a Partition, choose Availability or Consistency; Else, choose Latency or Consistency. It explains why systems trade consistency for speed even when the network is healthy.
  • Peak factor: the ratio of peak traffic to average traffic. It's typically 2–3× for daily cycles and 10× or more for launches, sales and live events. Systems must be sized for the peak.
  • Percentile (p50, p95, p99): the value below which that share of measurements falls. p99 = 300 ms means 1 request in 100 takes longer than 300 ms.
  • QPS / RPS: queries or requests per second, the basic unit of load. Average QPS = daily requests ÷ 86,400.
  • Read-your-writes consistency: a user always sees their own updates, even if other users see them later. It's usually achieved by reading from the leader, or by pinning the user to a replica, right after a write.
  • Reliability: the probability that a system performs correctly over a period of time. A system can be available (answering) yet unreliable (answering wrongly).
  • Scalability: the ability to handle more load by adding resources, with performance staying acceptable. A performance problem is slow for one user; a scalability problem is fast for one but slow under load.
  • Single point of failure (SPOF): any component whose failure takes the whole system down. Remove SPOFs with redundancy and failover.
  • Stateless service: a server that keeps no client data between requests; session and data live in a shared store. Any instance can serve any request, which makes scaling out and replacing instances trivial.
  • Strong consistency: every read returns the most recent committed write. It's often used loosely to mean linearizability. It costs latency and availability during failures.
  • Tail latency: the slowest requests (p99, p99.9). It matters most when a page fans out to many services, because the slowest one sets the page's speed.
  • Throughput: how much work completes per unit of time (requests/s, MB/s). Bandwidth is the maximum possible rate of a link; throughput is what you actually achieve.
  • Trade-off: a choice where gaining one property costs another, such as consistency vs availability, latency vs throughput, or cost vs performance. Good designs name the trade-off and why it fits.
  • Vertical scaling (scaling up): moving to a bigger machine with more CPU, RAM and disk. It's simple and keeps everything on one box, but has a hard ceiling and a single point of failure.

Glossary: networking#

  • Anycast: many servers in different places announce the same IP address, and the network routes each user to the nearest one. CDNs and DNS providers use it for speed and to soak up DDoS attacks.
  • CDN (content delivery network): a global fleet of edge servers (PoPs, points of presence) that cache content near users and fetch misses from your origin server. It cuts latency and offloads most media traffic.
  • DNS (Domain Name System): the internet's directory, turning names like example.com into IP addresses through a hierarchy of root, top-level-domain and authoritative servers, with caching at every step.
  • DNS record types: A and AAAA map a name to an IPv4 or IPv6 address, CNAME aliases one name to another, MX names mail servers, NS delegates a zone, and TXT holds verification text.
  • DNS TTL: how long resolvers may cache a record. Short TTLs (60 s) allow fast failover but cause more lookups. Long TTLs reduce load but delay changes.
  • Forward proxy: a server acting on behalf of clients, such as a corporate egress filter or anonymiser. The destination sees the proxy, not the user.
  • Head-of-line blocking: one lost or slow item holds up everything queued behind it. TCP's strict ordering causes it across all HTTP/2 streams on a connection, which is why HTTP/3 moved to QUIC.
  • Health check: a periodic probe (a TCP connect or an HTTP /health) that a load balancer uses to remove failed servers from rotation and add recovered ones back.
  • HTTP/2: many concurrent request streams multiplexed over one TCP connection, with compressed headers. It removed HTTP/1.1's one-request-at-a-time limit per connection.
  • HTTP/3: HTTP over QUIC on UDP. Each stream recovers losses independently, connection setup is faster, and connections survive network changes such as Wi-Fi to cellular.
  • HTTP methods, safety and idempotency: GET is safe (no side effects). GET, PUT and DELETE are idempotent (repeating them has the same effect). POST is neither by default, which is why payment APIs add idempotency keys.
  • IP address: a numeric address for a network interface. IPv4 is 32 bits (about 4.3 billion addresses); IPv6 is 128 bits. Private ranges (10.x, 192.168.x) aren't routable on the internet.
  • L4 vs L7 load balancing: Layer 4 balancers route by IP and port without reading the request, so they're very fast. Layer 7 balancers read HTTP and can route by path, header or cookie, at more CPU per request.
  • Load balancer: spreads incoming requests across a pool of servers, using an algorithm such as round robin, least connections or a consistent hash, and skips unhealthy servers.
  • Long polling: the client sends a request that the server holds open until data arrives or a timeout passes, then the client immediately asks again. It gives near-realtime updates over plain HTTP.
  • NAT (network address translation): a router rewrites private addresses to one public address, letting many devices share it. It's also why peer-to-peer connections need extra tricks.
  • OSI and TCP/IP models: layered descriptions of networking. Link, network (IP), transport (TCP/UDP) and application (HTTP) are the layers that matter for system design.
  • QUIC: a transport protocol over UDP with built-in TLS 1.3, independent streams and fast (often zero round trip) resumption. It's the foundation of HTTP/3.
  • Reverse proxy: a server in front of your servers that terminates TLS, compresses, caches, filters and forwards requests. Nginx and Envoy are common examples. Clients see the proxy, not the backends.
  • RTT (round-trip time): the time for a packet to go to a destination and back. It's under 1 ms within a data centre and 50–150 ms across continents. Every handshake costs one or more RTTs.
  • Server-sent events (SSE): a long-lived HTTP response through which the server streams events to the browser, one way only. It's simple, auto-reconnects, and is ideal for feeds, notifications and LLM token streaming.
  • Sticky sessions: the load balancer pins a client to one server, usually with a cookie. It's convenient for in-memory sessions, but it unbalances load and breaks on server loss, so prefer stateless servers.
  • TCP: a connection-oriented transport with a three-way handshake, delivering a reliable, ordered byte stream with flow and congestion control. Almost all web traffic used it until HTTP/3.
  • TLS and HTTPS: TLS encrypts and authenticates a connection using certificates; HTTPS is HTTP over TLS. The TLS 1.3 handshake costs one round trip, and TLS is usually terminated at the load balancer or reverse proxy.
  • UDP: a connectionless transport that sends individual datagrams with no delivery or ordering guarantees. It's fast and lightweight, and suits video calls, games, DNS and QUIC.
  • Webhook: a server-to-server callback. When an event happens, the provider POSTs it to a URL you registered, signed so you can verify it, and retried if you don't respond.
  • WebRTC: browser APIs for peer-to-peer audio, video and data. It uses STUN and TURN servers to get through NAT, and is the basis of in-browser video calls.
  • WebSocket: an HTTP connection upgraded to a persistent, full-duplex channel. Either side can send at any time, which suits chat, games and collaboration, at the cost of stateful connection servers.

Glossary: APIs#

  • API gateway: a single entry point for clients that handles routing, authentication, rate limiting, TLS, request transformation and observability before requests reach backend services.
  • API versioning: evolving an API without breaking existing clients, via URL (/v2/), header or field-level compatibility rules. Additive changes are safe; removals and renames are breaking.
  • BFF (backend for frontend): a thin server-side layer per client type (web, iOS, TV) that aggregates and shapes backend data into exactly what that client's screens need.
  • Cursor (keyset) pagination: returning a page plus an opaque cursor that encodes the last seen key, so the next query is WHERE key < cursor. It stays fast and stable as data changes, unlike OFFSET.
  • GraphQL: a query language where the client asks for exactly the fields it needs from a typed schema, and resolvers fetch them. It avoids over- and under-fetching but invites N+1 queries and complicates caching.
  • gRPC: an RPC framework over HTTP/2 using compact Protocol Buffers messages and generated client code. It supports streaming, and suits fast internal service-to-service calls.
  • Idempotency: an operation that has the same effect however many times it's applied. It's what makes retries safe after timeouts, where you can't know whether the first attempt succeeded.
  • Idempotency key: a unique client-generated ID sent with a request. The server stores the key with the result and returns the stored result on repeats, so a retried payment charges once.
  • Offset pagination: LIMIT 20 OFFSET 40. It's simple and allows jumping to page N, but slows down on deep pages and skips or duplicates rows when data changes between requests.
  • Protocol Buffers (protobuf): a compact binary serialisation format with a schema and numbered fields, so old and new versions stay compatible. It's used by gRPC and in many data pipelines.
  • REST: an API style built on resources (/users/42), standard HTTP methods and status codes, stateless requests and cacheable responses. It's the default for public APIs.

Glossary: storage and databases#

  • ACID: the guarantees of a database transaction. Atomicity: all or nothing. Consistency: constraints hold; note this is not CAP's consistency. Isolation: concurrent transactions don't interfere. Durability: committed data survives crashes.
  • Block, file and object storage: block is a raw disk volume (EBS); file is a shared filesystem with directories (NFS, EFS); object is a flat namespace of immutable blobs fetched over HTTP (S3). Each fits different access patterns.
  • B-tree: a balanced tree of fixed-size pages, the default index and storage structure in relational databases. It gives fast reads and range scans; writes update pages in place.
  • Clustered index: an index that is the table, with rows physically stored in key order (InnoDB's primary key). A secondary index stores keys plus a pointer back to the row, so it needs a second lookup.
  • Composite index: an index on several columns in a fixed order, e.g. (user_id, created_at). It serves queries that filter on a leftmost prefix of those columns, so column order matters.
  • Covering index: an index containing every column a query needs, so the database answers from the index alone without touching the table.
  • Data modeling: deciding entities, attributes, relationships and keys. In SQL you model the data and add indexes. In NoSQL you model the access patterns first and shape partitions around them.
  • Deadlock: two transactions each hold a lock the other needs, so neither can proceed. Databases detect the cycle and abort one. Prevent it by always taking locks in the same order.
  • Denormalization: deliberately duplicating data (a user's name on every post) to avoid joins on hot read paths. Reads get faster; writes get harder, because every copy must be updated.
  • Distributed file system: a filesystem spread across many machines, splitting files into replicated chunks under a metadata master. GFS and HDFS are the classic examples. Built for huge files and sequential throughput.
  • Document database: stores self-contained JSON-like documents, queried by fields. MongoDB is an example. Good for flexible, nested records read as a whole; weaker at cross-document joins and transactions.
  • Erasure coding: splitting data into k data pieces plus m parity pieces so any k of the k + m can rebuild it. It's as durable as several full copies at a fraction of the storage, and object stores use it widely.
  • Foreign key: a column referencing another table's primary key, which the database can enforce so references never dangle.
  • Graph database: stores nodes and edges with properties, optimised for multi-hop traversals such as friends-of-friends or fraud rings. Neo4j is an example, queried with Cypher or Gremlin.
  • Hot, warm, cold and archive tiers: storage classes ordered by access speed and cost. Lifecycle rules move ageing data down the tiers automatically. Archive can take hours to restore but costs a small fraction of hot storage.
  • Index: an auxiliary sorted structure that lets the database find rows without scanning the whole table. Each index speeds up some reads and slows every write that must update it.
  • Inverted index: a map from each word (term) to the list of documents containing it. It's the core structure of full-text search engines.
  • Isolation anomalies: the bugs weak isolation allows. Dirty read: seeing uncommitted data. Non-repeatable read: a row changes between two reads. Phantom: new rows appear in a range. Lost update: one write silently overwrites another. Write skew: two transactions each pass a check and together break it.
  • Isolation levels: how much concurrent transactions can see of each other, from read uncommitted through read committed and repeatable read to serializable. Weaker levels are faster but allow anomalies.
  • Key-value store: the simplest database, mapping keys to opaque values via get and put. Redis and DynamoDB are examples. It's extremely fast and easy to partition, but has no query flexibility beyond the key.
  • LSM tree (log-structured merge tree): buffers writes in an in-memory memtable, flushes them as sorted immutable SSTables, and merges files in the background (compaction). It gives very high write throughput, and is used in Cassandra and RocksDB.
  • MVCC (multi-version concurrency control): the database keeps several versions of each row, so readers see a consistent snapshot without blocking writers. PostgreSQL and InnoDB both use it.
  • N+1 query problem: fetching a list with one query, then issuing one more query per item. A page of 100 items makes 101 round trips. Fix it with joins, batching (WHERE id IN …) or data loaders.
  • NewSQL: databases offering SQL and ACID transactions with horizontal scaling, such as Spanner and CockroachDB. They pay for it with consensus and some write latency.
  • Normalization: organising tables so each fact is stored once (1NF to 3NF), which avoids update anomalies at the cost of joins on read.
  • Object storage: buckets of immutable objects addressed by key, with metadata and HTTP access. It's extremely durable (often quoted at eleven nines) and cheap per GB. S3 and GCS are examples. Not a filesystem: no in-place edits.
  • Optimistic locking: read a row with its version number, then write only WHERE version = n. If someone else changed it first, the write affects 0 rows and you retry. Cheap when conflicts are rare.
  • Pessimistic locking: take a lock before modifying data, e.g. SELECT … FOR UPDATE, so others wait. It's safe under heavy conflict but reduces concurrency and risks deadlocks.
  • Polyglot persistence: using several database types in one system, each for what it's best at (Postgres for orders, Redis for sessions, Elasticsearch for search), usually kept in sync from one source of truth.
  • Presigned URL: a time-limited, signed URL granting permission to upload or download one object directly from object storage, so large files bypass your app servers.
  • Primary key: the column or columns uniquely identifying each row. Its choice affects physical layout, index size and hot spots.
  • Read, write and space amplification: how many times more bytes a storage engine reads, writes or stores than the logical data. B-trees and LSM trees trade these three against one another.
  • Relational database (RDBMS): stores data in tables of rows with a fixed schema, queried with SQL and joined via keys, with ACID transactions. PostgreSQL and MySQL are the default choice for most systems.
  • Time-series data: measurements keyed by time (metrics, sensor readings), written append-only and queried by time window. It compresses extremely well.
  • Wide-column store: rows grouped by a partition key and sorted by clustering columns within the partition. Cassandra and Bigtable are examples. Built for huge write volumes and known query shapes.
  • Write-ahead log (WAL): every change is appended to a sequential log and flushed before the data pages are updated, so after a crash the database replays the log to recover. It's also the source for replication and CDC.

Glossary: scaling data#

  • Consistent hashing: keys and nodes are placed on a hash ring, and each key belongs to the next node clockwise. Adding or removing a node moves only about 1/N of the keys, instead of nearly all of them as with hash mod N.
  • Expand and contract: changing a schema without downtime in phases. Add the new structure, write to both, backfill, switch reads, then remove the old structure. Every step stays backward compatible.
  • Failover: promoting a replica to replace a failed leader, either automatically or manually. Risks include losing unreplicated writes and split brain.
  • Federation: splitting databases by function (users in one, orders in another). It's simple, but cross-domain joins move into application code.
  • Geo-partitioning: placing each user's or tenant's data in a home region for low latency and data-residency compliance, routing their requests there.
  • Hinted handoff: when a replica is down, another node accepts its writes temporarily and hands them over when it returns. It keeps writes available during short outages.
  • Hot spot (hot partition): one shard receiving far more traffic than others because of a popular key (a celebrity, a viral post) or a bad shard key such as a timestamp. Fixes include key splitting, caching and better keys.
  • Leader-follower replication: one leader accepts writes and streams changes to followers, which serve reads. It's simple and widely used. Followers lag slightly behind the leader.
  • Leaderless replication: any replica accepts reads and writes, and quorums plus repair keep them in step. This is Dynamo-style, used by Cassandra and Riak.
  • Merkle tree: a tree of hashes in which each parent hashes its children. Two replicas compare roots and descend only into differing branches, finding inconsistencies with little data transfer (anti-entropy).
  • Multi-leader replication: several leaders (often one per region) accept writes and replicate to each other. Local writes are fast, but concurrent writes conflict and need resolution.
  • Quorum (N, R, W): with N replicas, a write waits for W acknowledgements and a read queries R replicas. If R + W > N, every read overlaps the latest write.
  • Read repair: when a read finds replicas disagreeing, the coordinator writes the newest value back to the stale ones.
  • Read replica: a follower used to serve reads and offload the leader. Expect replication lag, so route read-your-writes paths to the leader.
  • Replication lag: the delay between a write on the leader and its appearance on a follower. It's usually milliseconds, but can reach seconds or minutes under load.
  • Replication: keeping copies of data on several machines for availability, read scale and lower latency. It can be synchronous (safe, slower), asynchronous (fast, may lose recent writes) or semi-synchronous.
  • Resharding: changing the number or layout of shards as data grows. It's done online by copying data, dual-writing and cutting over, ideally with consistent hashing to limit movement.
  • Saga: a multi-service transaction as a sequence of local transactions, each with a compensating action that undoes it if a later step fails. Coordinated by choreography (events) or orchestration (a coordinator).
  • Sharding (horizontal partitioning): splitting one dataset's rows across many databases by a key, using range, hash, directory or geo strategies. It scales writes and storage, at the cost of cross-shard queries.
  • Shard key (partition key): the field that decides which shard a row lives on. A good key spreads load evenly and keeps each query on one shard.
  • Sloppy quorum: accepting writes on any N reachable nodes, not necessarily the key's home replicas, during failures. Writes stay available, but R + W > N no longer guarantees fresh reads.
  • Split brain: two nodes both believe they're the leader and accept conflicting writes, usually after a network partition. Prevent it with quorum-based election and fencing.
  • Transactional outbox: writing an event into an outbox table in the same transaction as the business change, and having a relay publish it afterwards. The database and the message never disagree.
  • Two-phase commit (2PC): a coordinator asks all participants to prepare, then tells them to commit only if all voted yes. It's atomic across databases, but blocks if the coordinator fails mid-way.
  • Vector clock: a per-replica counter list attached to each value. It reveals whether one version descends from another or whether they're concurrent and must be merged.

Glossary: caching#

  • Cache-aside (lazy loading): the application reads the cache; on a miss, it reads the database and fills the cache. On writes, it updates the database and deletes the cache entry. It's the most common strategy.
  • Cache avalanche: many keys expire at the same moment, or the cache fails, and the database is flooded. Prevent it with TTL jitter, warm-up, and a highly available cache.
  • Cache: a fast store (usually memory) holding copies of data that is expensive to fetch or compute. It can live in the client, CDN, app server, a shared cache tier or the database itself.
  • Cache hit ratio: the fraction of reads served from the cache. Moving from 90% to 99% cuts backend load tenfold, so small ratio changes matter enormously.
  • Cache invalidation: removing or updating cached data when the source changes, via TTL expiry, explicit deletes, versioned keys or CDC events. It's famously one of the hardest problems in computing.
  • Cache penetration: requests for keys that don't exist anywhere bypass the cache every time and hit the database. Fix it with negative caching (cache "not found") or a Bloom filter of valid keys.
  • Cache stampede (thundering herd): a hot key expires and thousands of requests miss at once and all hit the database. Fix it with a per-key lock or request coalescing, early refresh, or serving stale data while one request refreshes.
  • Eviction policy: how a full cache picks what to drop. LRU drops the least recently used, LFU the least frequently used, plus FIFO, random and TTL-based. Admission policies such as W-TinyLFU improve hit rates.
  • Hot key: one cache key receiving so much traffic that it overloads a single cache node. Fix it with local in-process caching, replicating the key, or splitting it into sub-keys.
  • Memcached: a simple, multi-threaded, in-memory key-value cache with no persistence or rich types. It's excellent as a pure cache.
  • Read-through cache: the cache itself loads missing data from the database, so the application only ever talks to the cache.
  • Refresh-ahead: the cache reloads popular entries shortly before they expire, so readers never see a miss on hot keys.
  • TTL (time to live): how long an entry stays valid before expiring. It bounds staleness and memory use; shorter TTLs mean fresher data but more misses.
  • Write-around: writes go straight to the database and skip the cache, which fills only on reads. It avoids filling the cache with data nobody reads.
  • Write-behind (write-back): writes land in the cache and are flushed to the database asynchronously, often batched. Very fast writes, but data is lost if the cache dies first.
  • Write-through: every write updates the cache and the database synchronously, so the cache is always fresh, at the cost of slower writes.

Glossary: messaging and data processing#

  • Acknowledgement (ack): the consumer's signal that it finished processing a message, so the broker can delete it or advance past it. No ack within the visibility timeout means redelivery.
  • At-least-once delivery: a message is retried until acknowledged, so it's never lost but may arrive twice. It's the practical default; pair it with idempotent consumers.
  • At-most-once delivery: send once, never retry. Messages may be lost but never duplicated, which is acceptable for metrics samples or presence pings.
  • Back pressure: a slow consumer signals producers to slow down, or the system bounds its buffers and rejects excess, instead of letting queues grow until memory runs out.
  • Batch processing: processing a large, bounded dataset in one job, e.g. a nightly Spark run. It has high throughput and simple correctness, but results arrive hours later.
  • CDC (change data capture): reading a database's change log (Postgres WAL, MySQL binlog) and publishing each insert, update and delete as an event, often with Debezium into Kafka. It keeps caches, search indexes and warehouses in sync.
  • Choreography vs orchestration: in choreography, services react to each other's events with no central controller. In orchestration, one coordinator tells each service what to do next. The first is looser; the second is easier to follow and debug.
  • Consumer group: a set of consumers sharing a topic's partitions, so each message goes to one member. Several groups can each read the full stream independently.
  • CQRS (command query responsibility segregation): separate models for writes (commands) and reads (queries). The read side is often a denormalised view built from events, so each side can be optimised independently.
  • Data lake and lakehouse: a lake is raw and processed data in open file formats (such as Parquet) on cheap object storage. A lakehouse adds table formats (Iceberg, Delta) for transactions, schemas and time travel on top.
  • Data warehouse: a columnar analytics database for large aggregate queries over historical data, such as Snowflake, BigQuery or Redshift. It's the OLAP counterpart to OLTP databases.
  • Dead-letter queue (DLQ): where messages go after repeatedly failing processing, so one "poison" message doesn't block the queue and engineers can inspect it later.
  • Dual-write problem: updating a database and sending a message (or updating a cache) as two separate steps. A crash between them leaves the two disagreeing. Solved with the outbox pattern or CDC.
  • ETL vs ELT: extract, transform, load cleans data before loading it into the warehouse. Extract, load, transform loads raw data first and transforms it inside the warehouse with SQL. ELT dominates with cheap cloud warehouses.
  • Event: an immutable fact that something happened (OrderPlaced), published for anyone interested. A command asks a specific service to do something.
  • Event sourcing: storing the sequence of events as the source of truth and deriving current state by replaying them, with snapshots for speed. It gives a full audit trail and time travel.
  • Event time vs processing time: when an event actually happened vs when the system processed it. Windows based on event time give correct results even when data arrives late or out of order.
  • Exactly-once (effectively-once) processing: each message affects the result exactly once. In practice that's at-least-once delivery plus idempotent or transactional processing, not a magic network guarantee.
  • Lambda and kappa architectures: lambda runs a batch layer for accuracy alongside a stream layer for freshness. Kappa uses one streaming pipeline and reprocesses by replaying the log.
  • Log-based broker: a broker (Kafka, Pulsar, Kinesis) that appends messages to a durable, partitioned log. Consumers track their own offsets and can replay; nothing is deleted on read.
  • Message queue: a buffer where producers leave tasks and consumers take them, each task going to one worker. SQS and RabbitMQ are examples. It decouples timing and absorbs bursts.
  • OLTP vs OLAP: online transaction processing handles many small reads and writes of individual records. Online analytical processing handles few huge scans and aggregations. Different storage layouts suit each: row-oriented vs columnar.
  • Parquet (columnar format): an open file format storing each column contiguously in row groups and pages, with statistics in a footer. Scans read only the columns they need and compress very well.
  • Partition (in a stream): an ordered, append-only shard of a topic. Order is guaranteed only within a partition, so events that must stay ordered share a partition key.
  • Pub/sub: publishers send to a topic, and every subscriber receives a copy. It's the fan-out counterpart to a queue's one-consumer-per-message.
  • Stream processing: processing unbounded data continuously as it arrives, with state, windows and checkpoints, for second-level freshness. Flink and Kafka Streams are examples.
  • Watermark: a stream processor's estimate that "all events up to time T have probably arrived", which tells it when a window can be closed and emitted. Later arrivals are handled as late data.
  • Windowing: grouping a stream into finite chunks. Tumbling windows are fixed and non-overlapping, sliding windows overlap, and session windows are separated by gaps of inactivity.

Glossary: distributed systems#

  • Bloom filter: a compact bit array answering "definitely not present" or "possibly present". It skips needless disk reads and lookups using about 10 bits per key for a 1% false-positive rate.
  • Byzantine fault: a node that behaves arbitrarily or maliciously, not just by crashing. Most data-centre systems assume crash faults only; blockchains must tolerate Byzantine ones.
  • Consensus: getting a group of nodes to agree on one value, or one ordered log, despite failures. Raft and Paxos do this with a majority quorum, tolerating f failures with 2f + 1 nodes.
  • Count-min sketch: a small grid of counters that estimates how often each item appeared in a stream. It may overcount but never undercounts, which makes it useful for heavy hitters and top-k.
  • CRDT (conflict-free replicated data type): a data structure whose replicas can be updated independently and always merge to the same result, such as counters, sets and sequences. It's used for offline-first and collaborative apps.
  • Distributed lock: a lock shared across machines, typically a Redis key with a TTL or an etcd/ZooKeeper lease, so only one worker acts at a time. It needs fencing tokens to be truly safe.
  • Fallacies of distributed computing: false assumptions newcomers make, such as that the network is reliable, latency is zero, bandwidth is infinite, or the topology never changes. Every one causes real outages.
  • Fencing token: a number that increases with every lock grant or leader term. Storage rejects writes carrying an older token, so a paused ex-leader can't corrupt data.
  • Geohash: encodes latitude and longitude as a string, where a longer shared prefix means closer locations. It turns proximity search into prefix or range queries on an ordinary index.
  • Gossip protocol: each node periodically exchanges state with a few random peers, so information spreads through the cluster in O(log N) rounds. It's used for membership and failure detection in Cassandra and Consul.
  • H3 and S2: hierarchical cell systems that tile the globe, hexagons for H3 (Uber) and squares on a cube for S2 (Google). Each cell has an ID, which makes "nearby" a set lookup.
  • Heartbeat: a periodic "I'm alive" message. Missing several marks a node as suspected dead. Phi-accrual detectors adapt the threshold to observed network jitter.
  • Hybrid logical clock (HLC): a timestamp combining physical time with a logical counter. It stays close to wall-clock time while still capturing causality.
  • HyperLogLog: estimates the number of distinct items (unique visitors) in about 12 KB with roughly 1% error, whatever the cardinality. Redis offers it built in.
  • Lamport clock: a counter each node increments on events and advances when it receives a higher value. If A happened-before B, A's timestamp is smaller, though not necessarily the reverse.
  • Leader election: choosing exactly one node to coordinate work, usually through a consensus store with leases that expire if the leader stops renewing.
  • Lease: a lock with an expiry time. The holder must renew it, so a crashed holder's rights lapse automatically.
  • Operational transformation (OT): a collaborative-editing technique that adjusts each concurrent edit against the others (shifting positions) so all copies converge. It's usually run through a central server, as in Google Docs.
  • Partial failure: some parts of a system fail while others keep working, and a timeout can't tell a crashed node from a slow one. This is what makes distributed systems hard.
  • Quadtree: a spatial index that recursively splits a map into four cells until each holds few points. It adapts naturally to density (cities vs oceans).
  • Raft: a consensus algorithm designed for understandability. One elected leader appends entries to a replicated log and commits them once a majority store them. It's used by etcd and CockroachDB.
  • Replicated state machine: every replica applies the same ordered log of commands to the same initial state, so all end in identical states. It's the core idea behind consensus-based systems.
  • Safety vs liveness: safety means nothing bad ever happens (no two leaders). Liveness means something good eventually happens (a leader gets elected). Under failures, systems usually guarantee safety and do their best on liveness.
  • Snowflake ID: a 64-bit ID made of a timestamp, a machine ID and a per-machine sequence. It's unique without coordination and sortable by time, as used by Twitter.
  • TrueTime: Google's clock API that returns an interval guaranteed to contain the true time, backed by GPS and atomic clocks. Spanner waits out the uncertainty to give globally ordered transactions.
  • UUID v4 vs v7: v4 is 122 random bits, unique but unordered, so it scatters B-tree inserts. v7 puts a millisecond timestamp first, so IDs are time-sortable and index-friendly.
  • Wall-clock skew: machines' clocks disagree by milliseconds or more, even with NTP. So "latest timestamp wins" can silently discard the truly later write.

Glossary: architecture and patterns#

  • Aggregate (DDD): a cluster of objects treated as one unit for changes, with one root entity enforcing its rules (an Order with its line items). Transactions shouldn't span aggregates.
  • Bounded context: a part of the domain with its own consistent model and language. "Customer" can mean different things in billing and shipping. Bounded contexts are natural service boundaries.
  • Architecture Decision Record (ADR): a short document recording one significant design decision: its context, the options considered, the choice and its consequences. ADRs keep the reasoning visible after the people who made it move on, so later engineers can see why, not just what.
  • Cell-based architecture: splitting a system into many identical, independent copies (cells), each serving a slice of users, so a failure or bad deploy affects only one cell's blast radius.
  • Cold start: the delay when a serverless platform must create a fresh execution environment before running a function. It ranges from tens of milliseconds to seconds, depending on runtime and package size.
  • Conway's law: the observation that systems tend to mirror the communication structure of the organisation that builds them. Teams use it on purpose by aligning team boundaries with service or module boundaries (sometimes called the inverse Conway manoeuvre).
  • Edge function: code running at CDN points of presence close to users, for auth checks, redirects, A/B routing and personalisation. Cloudflare Workers and Lambda@Edge are examples.
  • KISS: "keep it simple": prefer the simplest design that meets the requirements, using existing or managed components before building your own. Khan Academy hosting videos on YouTube and Levels.fyi starting on Google Sheets are examples. Simplicity is cheaper to run, easier to change and fails in fewer ways.
  • Microservices: an application split into small, independently deployable services, each owning its data. Teams get independence, at the cost of network calls, distributed failures and operational overhead.
  • Modular monolith: one deployable application with strictly separated internal modules. It gives most of the organisational benefits of microservices without the distributed-systems cost, and is often the right default.
  • Multi-tenancy: one system serving many customers (tenants), as silo (dedicated resources per tenant), pool (shared resources with a tenant_id), or a bridge mixing the two.
  • Noisy neighbour: one tenant's heavy usage degrading performance for others on shared infrastructure. Fix it with quotas, rate limits, isolation and per-tenant queues.
  • Pattern: contention: techniques for many users competing for the same item (seats, stock, bids): atomic updates, locks, optimistic concurrency, reservations with expiry, and queues per hot item.
  • Pattern: large blobs: keeping big files off app servers with presigned URLs, multipart and resumable uploads, a metadata database plus a blob store, and CDN delivery.
  • Pattern: long-running tasks: return a job ID immediately, do the work asynchronously with queued workers, and expose status by polling or push, with retries and dead-letter queues.
  • Pattern: multi-step processes: making flows across services complete reliably with sagas, persisted state machines, workflow engines and durable execution.
  • Pattern: realtime updates: pushing changes to connected clients through connection servers, pub/sub fan-out, presence tracking and catch-up after reconnect.
  • Pattern: scaling reads: the escalation ladder for read-heavy systems: indexes, then vertical scaling, read replicas, caches, CDN and materialised views, plus a plan for replication lag.
  • Pattern: scaling writes: the ladder for write-heavy systems: write-optimised stores, sharding, batching and buffering, sharded counters and load shedding.
  • Serverless (FaaS): running functions triggered by events, with the provider handling servers and scaling, including to zero. You pay per invocation. Ideal for spiky, short, stateless work.
  • Service discovery: how services find each other's current addresses through a registry (Consul, etcd, Kubernetes DNS), either client-side or via a load balancer.
  • Service mesh: a layer of sidecar proxies, such as Envoy managed by Istio or Linkerd, that handles service-to-service traffic: mTLS, retries, timeouts, routing and telemetry, without changing application code.
  • Sidecar: a helper process deployed next to each service instance (for logging, proxying or config) and sharing its lifecycle.
  • SOLID: five object-oriented design principles that also map onto service and module design. Single responsibility (one reason to change), open-closed (extend behaviour without editing existing code), Liskov substitution (a subtype must work wherever its parent type does), interface segregation (small, focused interfaces rather than one large one) and dependency inversion (depend on abstractions, not concrete implementations). At system level they become: one bounded context per service, stable public APIs, and depending on interfaces such as a queue or contract rather than another team's internals.
  • Strangler fig: migrating a legacy system gradually by routing one feature at a time to new code until the old system can be removed.
  • YAGNI: "you aren't gonna need it": do not build for scale or features you do not yet need. Pair it with an exit plan, so the simple version can be replaced when a real limit appears.

Glossary: reliability, security and operations#

  • ABAC, RBAC and ReBAC: authorization models. Role-based: permissions attach to roles. Attribute-based: rules over user and resource attributes. Relationship-based: access follows relationships in a graph, as in Google's Zanzibar.
  • Authentication vs authorization: authentication (authn) proves who you are. Authorization (authz) decides what you may do. A 401 status means "who are you?", and a 403 means "you can't do that".
  • Availability zones and regions: a region is a geographic area; an availability zone is an isolated data centre (or group of them) within it. Spread across zones for HA, and across regions for DR and global latency.
  • Blue-green deployment: run two identical environments and switch traffic from the old (blue) to the new (green) in one step. Rollback is switching back.
  • Bulkhead: isolating resources (thread pools, connection pools, queues) per dependency or tenant, so one failing part can't exhaust capacity for everything else.
  • Canary release: sending a new version to a small slice of traffic first, watching error and latency metrics, then widening, or rolling back automatically.
  • Capacity planning: forecasting demand, keeping headroom below the utilisation "knee" where queueing delay explodes, and validating with load, stress, soak and spike tests.
  • Chaos engineering: deliberately injecting failures (killing instances, adding latency) in a controlled way to prove that the system tolerates them. Netflix popularised it.
  • Circuit breaker: after repeated failures to a dependency, stop calling it for a while (open), then let a few trial requests through (half-open), and resume (closed) if they succeed. It prevents cascading failures.
  • Cloud egress cost: charges for data leaving a cloud region or provider, often the surprise line on the bill for media-heavy or cross-region designs.
  • Container: a packaged application with its dependencies, running in an isolated process on a shared OS kernel. It's lighter and faster to start than a virtual machine.
  • DDoS protection and WAF: absorbing floods of malicious traffic at the network edge, and a web application firewall that filters requests matching attack patterns (injection, bots) before they reach your servers.
  • DORA metrics: four measures of delivery performance: deployment frequency, lead time for changes, change failure rate and time to restore service.
  • DR strategies: from cheapest and slowest to most expensive and fastest: backup and restore, pilot light (core services idle in a second region), warm standby (scaled-down copy running), multi-site active-active.
  • Encoding vs encryption vs hashing: encoding (Base64) changes format and is reversible by anyone. Encryption is reversible only with a key. Hashing is one-way and is used for integrity and, with salts and slow algorithms, for passwords.
  • Encryption at rest and in transit: at rest protects stored data (disk, backups) with keys held in a KMS. In transit protects data moving over networks with TLS. Modern systems need both.
  • Error budget: the unreliability an SLO allows, e.g. 0.1% of requests for 99.9%. While budget remains, ship features. When it's spent, prioritise reliability.
  • Exponential backoff with jitter: waiting progressively longer between retries (100 ms, 200 ms, 400 ms…) plus randomness, so many clients don't retry in synchronised waves.
  • Feature flag: a runtime switch that turns code paths on or off without a deploy, enabling gradual rollouts, experiments and instant kill switches.
  • Golden signals, RED and USE: monitoring checklists. Golden signals: latency, traffic, errors, saturation. RED for services: rate, errors, duration. USE for resources: utilisation, saturation, errors.
  • Graceful degradation: when a dependency fails, serve a reduced experience (cached results, hidden widgets) instead of an error page.
  • High availability (HA): designing out downtime with redundancy at every layer, multiple availability zones, automatic failover, health checks and self-healing.
  • Infrastructure as code (IaC): defining servers, networks and services in versioned files (Terraform, CloudFormation) that are reviewed and applied automatically, instead of clicking through consoles.
  • JWT (JSON Web Token): a signed token carrying claims (user ID, expiry), which services verify without a database lookup. It's hard to revoke before it expires, so keep lifetimes short.
  • Kubernetes: a container orchestrator. A control plane schedules pods onto nodes, restarts failed ones, scales them and wires up networking through services and ingress.
  • Least privilege: every user, service and key gets only the permissions it needs, which limits the damage when one is compromised.
  • Load shedding: deliberately rejecting some requests, often the lowest priority, when overloaded, so that the rest still succeed instead of everything timing out.
  • Logs, metrics and traces: the three pillars of observability. Logs are discrete event records, metrics are numeric time series, and traces follow one request across services as a tree of spans.
  • Metric types: a counter only goes up (requests served), a gauge goes up and down (queue depth), and a histogram buckets values (latency distribution) so percentiles can be computed.
  • MFA, TOTP and passkeys: multi-factor authentication combines something you know, have or are. TOTP apps derive six-digit codes from a shared secret and the current time. Passkeys (WebAuthn) use device-held key pairs and resist phishing.
  • mTLS (mutual TLS): both sides of a connection present certificates, so services authenticate each other. It's common inside service meshes and zero-trust networks.
  • OAuth 2.0 and OpenID Connect: OAuth lets an app obtain limited access tokens on a user's behalf (with PKCE for public clients). OIDC adds an identity token on top, enabling "Sign in with…" and single sign-on.
  • Password hashing: store passwords only as salted hashes from deliberately slow algorithms (bcrypt, scrypt, Argon2), so stolen hashes are expensive to crack.
  • Postmortem: a blameless write-up after an incident covering the timeline, impact, contributing factors and tracked action items, aimed at learning rather than blame.
  • Rate limiting: capping how many requests a client may make per period, enforced at the gateway or service and answered with HTTP 429 plus retry headers. It protects capacity and fairness.
  • Retry budget: capping retries at a fraction of normal traffic (say 10%), so retries can't multiply load during an outage and cause a retry storm.
  • RPO and RTO: recovery point objective is how much data loss is tolerable, measured in time. Recovery time objective is how long recovery may take. They drive backup frequency and DR strategy.
  • Secrets management: storing credentials and keys in a dedicated service (Vault, a cloud KMS or secrets manager) with access control, rotation and audit, never in code or plain config.
  • SLI, SLO and SLA: the indicator is the measured quantity (success rate, p99 latency), the objective is the internal target (99.9% over 30 days), and the agreement is the external contract, with penalties if missed.
  • Timeout: an upper bound on how long to wait for a call. Without one, a slow dependency ties up threads until the caller fails too. Every network call needs one.
  • Token bucket: a rate-limiting algorithm. A bucket refills at a steady rate up to a cap, and each request takes a token, which allows short bursts while enforcing an average rate.
  • Twelve-factor app: conventions for cloud-friendly services: configuration in the environment, stateless processes, backing services as attached resources, logs as event streams, and dev/prod parity.

Glossary: technologies#

  • Cassandra / ScyllaDB: leaderless wide-column stores on a consistent-hash ring, with LSM storage, tunable consistency and massive write throughput. Model the table around the query.
  • DynamoDB: AWS's managed key-value and document store. You define partition and sort keys plus secondary indexes (GSI/LSI), with on-demand or provisioned capacity, streams and global tables.
  • Elasticsearch / OpenSearch: distributed search engines built on inverted indexes, with BM25 relevance, aggregations and geo queries. Usually fed from the primary database through CDC, not used as the source of truth.
  • Flink: a stateful stream-processing engine with event-time windows, watermarks and checkpointed exactly-once state. Used for realtime aggregation, enrichment and fraud detection.
  • Kafka: a distributed, replicated, partitioned commit log handling millions of messages per second across a cluster. Consumer groups, retention and replay make it the backbone of event streaming.
  • PostgreSQL: a full-featured open-source relational database with MVCC, rich indexes (B-tree, GIN, GiST, BRIN), JSONB and extensions such as PostGIS and pgvector. It's the safest default database.
  • Redis: an in-memory data-structure server (strings, hashes, sorted sets, streams, HyperLogLog, geo) with sub-millisecond latency. It's used for caches, sessions, rate limiters, leaderboards, locks and queues.
  • Temporal (workflow engine): durable execution. Workflow code is replayed from a recorded event history, so long multi-step processes survive crashes, with built-in retries, timers and signals.
  • Time-series database: a store optimised for timestamped metrics, using compression (delta-of-delta, XOR), downsampling and retention. Prometheus, InfluxDB and TimescaleDB are examples. Watch label cardinality.
  • Vector database: stores embeddings and finds nearest neighbours with approximate indexes (HNSW, IVF, product quantization), trading a little recall for large speed-ups. pgvector, Pinecone and Milvus are examples.
  • ZooKeeper / etcd: small, strongly consistent coordination stores (ZAB and Raft) offering watches, ephemeral nodes and leases for leader election, locks, config and service discovery.

Glossary: AI, ML and client systems#

  • Agent: an LLM in a loop that plans, calls tools (search, code, APIs), observes the results and continues until the task is done. It needs guardrails, sandboxing and budgets on steps and cost.
  • Embedding: a vector of numbers representing meaning (of a text, image or user), such that similar things are close together. It's the input to vector search and recommendations.
  • Feature store: a system that computes ML features once and serves them consistently, from an offline store for training (with point-in-time correctness) and an online store for low-latency inference.
  • Fine-tuning (LoRA): further training a pretrained model on task data. LoRA trains small low-rank adapter matrices instead of all weights, so fine-tuning becomes cheap and many adapters can share one base model.
  • KV cache (LLM): stored attention keys and values for the tokens already processed, so each new token in decode doesn't recompute the whole prompt. It's often the main consumer of GPU memory.
  • Offline-first sync: the client reads and writes a local database and syncs changes with the server in the background through an outbox, so the app works without a network.
  • Prefill vs decode: LLM inference in two phases. Prefill processes the whole prompt in parallel and is compute-bound. Decode generates one token at a time and is memory-bandwidth-bound. They're scaled and batched differently.
  • RAG (retrieval-augmented generation): retrieve relevant documents (via vector or hybrid search, then reranking) and put them in the prompt, so the model answers from current, private data with citations.
  • Rendering strategies (CSR, SSR, SSG): client-side rendering builds pages in the browser, server-side renders HTML per request, and static generation pre-builds pages at deploy time. They trade first-paint speed, freshness and server cost.
  • Training-serving skew: a model performing worse in production because features are computed differently at serving time than at training time. Feature stores exist largely to prevent it.

When to Use It#

  • The day before an interview. Read the requirements checklist and the estimation formulas aloud once. Then practise one prompt end to end using only this page, and follow links wherever you hesitated.
  • At the start of a real design. Run the requirements checklist with your product partner before anyone draws boxes. Missing a consistency or retention requirement is the most expensive mistake to discover later.
  • During design reviews. Check that the proposal states peak QPS, storage growth, the read/write ratio and the consistency choice per data type, and that every added component traces back to one of those numbers.
  • When you meet an unfamiliar term in a design doc, paper or interview question. The glossary gives the one-line meaning and the page with the full story.
  • When a problem feels new. Run the pattern picker. Most "new" problems are a known pattern (contention, fan-out, long-running work) with different nouns.

When NOT to Use It#

Pick something else instead when:

  • You need to understand why. A one-line definition of "linearizability" or "saga" isn't understanding. Read the linked page, especially its trade-offs and deep dive, before relying on the idea in a design.
  • You're tempted to recite the cheat sheet. Interviewers notice a checklist read without thought ("now I'll add a cache") when nothing in the requirements called for it. Use the sheet to make sure nothing is forgotten, then reason from the problem.
  • Your numbers come from real measurements. If you have production metrics, load tests or vendor benchmarks for your workload, they override the rough capacities here (Capacity Planning and Load Testing).
  • The domain has its own rules. Payments, healthcare and trading have regulatory and correctness requirements no generic checklist captures (Design a Payment System).

How to Implement It#

A repeatable way to use the cheat sheet in a 45-minute interview or a design kick-off (The System Design Interview Framework, The Design Process: From Problem to Architecture):

  1. Requirements (about 5 minutes). Run the checklist. Write the 3–5 functional requirements and the key non-functional numbers on the board, then confirm them with the interviewer.
  2. Estimates (2–3 minutes, only where they decide something). Compute peak read and write QPS, yearly storage and, if media is involved, bandwidth. Say what each number implies.
  3. Core entities and API (about 5 minutes). List the nouns (User, Post, Follow), then one endpoint per functional requirement (API Design Best Practices).
  4. High-level design (10–15 minutes). Start from the simplest stack and add components from the picker, naming the requirement each one serves. Walk one request end to end.
  5. Deep dives (10–15 minutes). Use the pattern picker to choose the one or two places where the design is hardest (hot keys, contention, fan-out), and go deep there with numbers and failure modes.
  6. Wrap up (2 minutes). Name the trade-offs you made, the bottleneck at 10× scale, and what you'd monitor.

A tiny estimation helper captures the formulas. Interviewers don't want code, but writing it once fixes the arithmetic in memory:

// Back-of-the-envelope helper: inputs are rough; outputs are orders of magnitude.
interface Load { dau: number; writesPerUser: number; readsPerUser: number;
  bytesPerWrite: number; peakFactor: number; years: number; replication: number;
  qpsPerServer: number; hotFraction: number; }
 
const SECONDS_PER_DAY = 86_400;
 
function estimate(l: Load) {
  const writeQps = (l.dau * l.writesPerUser) / SECONDS_PER_DAY;
  const readQps = (l.dau * l.readsPerUser) / SECONDS_PER_DAY;
  const peakQps = (writeQps + readQps) * l.peakFactor;
  const storagePerDay = l.dau * l.writesPerUser * l.bytesPerWrite;
  const totalStorage = storagePerDay * 365 * l.years * l.replication;
  const servers = Math.ceil((peakQps / l.qpsPerServer) * 1.5); // 50% headroom
  const cacheBytes = readQps * SECONDS_PER_DAY * l.bytesPerWrite * l.hotFraction; // upper bound: assumes unique daily reads
  return { writeQps, readQps, peakQps, storagePerDay, totalStorage, servers, cacheBytes };
}
 
// 100M DAU, 2 writes and 50 reads per user, 1 KB items, peak 3x, 5 years, RF 3
console.log(estimate({ dau: 1e8, writesPerUser: 2, readsPerUser: 50, bytesPerWrite: 1_000,
  peakFactor: 3, years: 5, replication: 3, qpsPerServer: 5_000, hotFraction: 0.2 }));
// writeQps ~2.3k, readQps ~58k, peak ~180k, storage ~200 GB/day, ~1.1 PB total, ~55 servers

Default technology choices that go with the component picker (each is the "boring" safe answer unless a requirement says otherwise; see Choosing Technologies: Communication, Caching, Messaging, Compute):

TechnologyFits when
PostgreSQL / MySQLDefault system of record: transactions, relations, up to several TB per primary
RedisCache, sessions, counters, leaderboards, rate limits, simple locks
KafkaEvent streams with several consumers, replay, CDC, high-volume ingest
SQS / RabbitMQTask queues: one worker per job, retries, dead-letter queues
S3 / GCS + CloudFront / CloudflareAny blob, served globally through a CDN
Elasticsearch / OpenSearchFull-text and faceted search fed by CDC
Cassandra / DynamoDBWrite-heavy, key-access data beyond one relational primary
Kubernetes or a managed container serviceRunning many stateless services with autoscaling
Temporal / Step FunctionsMulti-step business workflows with retries and long waits
Prometheus + Grafana + OpenTelemetryMetrics, dashboards, traces and SLO alerting

Trade-offs#

OptionProsConsPick when
Follow the checklist strictlyNothing forgotten; structured, calm deliveryCan feel mechanical; wastes time on irrelevant itemsEarly practice; real design kick-offs
Adapt the checklist to the promptTime goes where the problem is hardRisk of skipping something that matteredOnce the checklist is habit
Full estimation up frontNumbers justify every later choiceBurns interview minutes on arithmetic nobody needsScale-sensitive prompts (feeds, ingest, storage)
Estimate just-in-timeOnly computes numbers that decide somethingEasy to forget peak or storage until challengedProduct-style prompts with modest scale
Default "boring" stackProven, easy to defend, fewer moving partsMay under-serve an unusual requirementAlmost always as the starting point
Specialised technologyFits an extreme requirement exactlyMore to justify, operate and explainA number clearly exceeds the default's limits

Common Pitfalls#

  • Average instead of peak. Sizing for average QPS guarantees an outage at the daily peak or launch spike. Always multiply by a peak factor and say which one.
  • Stale hardware numbers. Assuming a database tops out at 100 GB, or that a server has 16 GB of RAM, leads to premature sharding and needless caches. Modern single machines are huge.
  • Estimates without conclusions. "We need 36 TB a year" means nothing until you add "…which fits a single sharded Postgres cluster" or "…so media goes to object storage".
  • One consistency level for everything. Different data in the same product needs different guarantees: bookings strong, view counts eventual. State the choice per data type.
  • Components without a reason. Every box should trace back to a requirement or a number. A queue "for scalability" that nothing needs is a red flag.
  • Confusing similar terms. Mixing up ACID consistency and CAP consistency, or a network partition and a data partition, or exactly-once delivery and exactly-once processing, undermines credibility quickly. See the first deep dive.
  • Pattern matching on nouns. "It's a chat app, so WebSockets" can be right, but check the actual requirements. Some "chat" prompts are really about storage and search.
  • Treating the cheat sheet as the ceiling. The linked pages contain the depth interviewers probe at senior levels. The sheet only gets you to the right page.

Real-World Examples#

Typical scenario: URL shortener in 3 minutes of estimation (Design a URL Shortener (Bitly)).

  • Load. 100 M new links a month is about 40 writes/s. At a 100:1 read ratio, that's about 4,000 redirects/s on average, or 12,000/s at a 3× peak.
  • Storage. 500 bytes per link × 1.2 B links a year is 600 GB a year, 3 TB over 5 years: one relational database, or a key-value store, with replicas.
  • Conclusions. Writes are trivial. Reads want a cache: caching 20% of a day's ~350 M redirects at 500 bytes each is about 35 GB, one large Redis node or a small cluster. A 7-character base-62 code gives 62⁷ ≈ 3.5 trillion combinations, more than enough.
  • Patterns. Scaling Reads (cache plus CDN for redirects) and Unique ID Generation (no collisions without coordination).

Typical scenario: chat system, picking components from requirements (Design a Chat System (WhatsApp)).

  • Requirements. Realtime delivery and an online/offline status point to WebSockets behind connection gateways.
  • Storage. Messages are write-heavy, append-only and read by conversation and time, which suits a wide-column store partitioned by conversation.
  • Delivery. Offline delivery needs push notifications through APNs or FCM. Media goes to object storage with presigned URLs.
  • Patterns. Realtime Updates plus Scaling Writes, and Large Blobs for attachments.

Typical scenario: ticketing, the pattern picker in action (Design a Ticket Booking System (Ticketmaster)).

  • "Many users want the same seat" → Dealing with Contention: reservations with expiry and row-level claims.
  • "Event pages viewed by millions during an on-sale" → Scaling Reads: CDN and cache.
  • "Seat map updates live" → Realtime Updates.
  • "Traffic spikes 100× at on-sale" → a virtual waiting room in front of everything.

The lessons drawn from published production write-ups are collected in Real-World Architecture Lessons.

Case studies that use this pattern#

Every case study applies the cheat sheet's flow. These show each block most clearly:

In the Interview#

Common follow-ups:

  • "Why didn't you shard the database?" Because the numbers don't require it yet: say ~3 TB over five years and ~40 writes/s, which fits one primary with replicas. I'd shard by link code when writes or the working set outgrow one node, and consistent hashing keeps resharding cheap.
  • "How did you get that QPS?" Daily actions ÷ ~10⁵ seconds gives the average, times a peak factor of 2–3× for normal traffic or 10× for event-driven spikes. Reads are writes times the read ratio.
  • "Is this strongly or eventually consistent?" Per data type: the mapping from code to URL must never be wrong, so it gets a unique constraint on write. Click counts can be eventually consistent and aggregated asynchronously.
  • "What's the first thing to break at 10× scale?" Name the component and the number: "the cache tier's hot keys during a viral link". Then name the fix: local caching plus key replication.
  • "What's the difference between your cache's TTL and invalidation?" The TTL bounds staleness passively. Invalidation removes the entry when the source changes. With immutable mappings, a long TTL is safe and invalidation is needed only for deletes.
Deep Dive: Terms that sound alike but are notShow

Many interview stumbles are vocabulary collisions. These pairs cause the most confusion, and each has a precise meaning worth stating aloud.

Consistency (ACID) vs consistency (CAP).

  • ACID's C means a transaction moves the database from one valid state to another. Constraints, foreign keys and invariants hold. It's largely the application's job, with the database enforcing declared constraints.
  • CAP's C means linearizability: every read sees the latest write, as if there were one copy. A single-node database can be perfectly ACID and the question of CAP doesn't arise. A replicated store can be "eventually consistent" in the CAP sense while every individual write is atomic and durable.

Partition (network) vs partition (data).

  • A network partition is a failure where nodes can't reach each other. It's what CAP is about.
  • A data partition (a shard) is a deliberate slice of a dataset. Kafka "partitions" and Cassandra "partition keys" are data partitions. When someone says "partition tolerance", they always mean the network kind.

Replication vs sharding.

  • Replication copies the same data to several nodes, for availability and read scale.
  • Sharding splits different data across nodes, for write scale and capacity.
  • Real systems do both. Each shard is replicated, typically three times.

Latency vs response time vs throughput vs bandwidth.

  • Latency strictly means the time a request spends waiting to be handled. Response time is what the client sees end to end: network, queueing and service time combined. In everyday use, "latency" usually means response time, and saying which one you mean avoids confusion.
  • Throughput is completed work per second. Bandwidth is the maximum rate a link can carry.
  • A system can have high throughput and terrible latency. A batch pipeline is the extreme example.

Exactly-once delivery vs exactly-once processing.

  • Delivery. No network can guarantee a message is delivered exactly once. If an acknowledgement is lost, the sender can't know whether to resend.
  • Processing. What systems actually offer is that the effect is applied exactly once. That's built from at-least-once delivery plus idempotent writes, deduplication by message ID, or atomic "consume, process, produce" transactions, as in Kafka's transactional API.

Idempotent vs safe vs commutative.

  • Safe (HTTP GET) means no side effects at all.
  • Idempotent means applying the operation twice equals applying it once: "set balance to 100", DELETE.
  • Commutative means order doesn't matter ("add 5" then "add 3" equals "add 3" then "add 5"), but applying it twice is not the same as once.
  • CRDTs need both properties for their merges. Retry-safe APIs need idempotency.

High availability vs fault tolerance vs disaster recovery.

  • High availability minimises downtime from common failures (an instance or an AZ) through redundancy and fast failover, and may drop a few in-flight requests.
  • Fault tolerance aims for no visible failure at all, at higher cost.
  • Disaster recovery is the plan for losing a whole region or dataset, measured by RPO and RTO, and is usually slower and partly manual.

Cache-aside vs read-through. Both fill the cache on a miss. The difference is who does the filling: the application code (cache-aside) or the cache library or service itself (read-through). Their consistency behaviour on writes is decided by the separate write policy: write-through, write-behind or invalidate-on-write.

Queue vs topic (stream).

  • A queue gives each message to one consumer. Messages disappear once acknowledged. It's for work distribution.
  • A topic gives each message to every subscribing group. A log-based topic retains messages for replay. It's for event distribution.
  • Kafka supports both. Consumer groups get queue semantics within a group and pub/sub across groups.

Authentication vs authorization; encryption vs hashing vs encoding.

  • Authn vs authz. Authentication establishes identity; authorization checks permissions against that identity.
  • Encryption is reversible with a key. Hashing is one-way. Encoding is reversible by anyone and offers no secrecy. "Base64-encrypted" isn't a thing.

Leader vs primary vs master; follower vs replica vs standby. These are mostly synonyms across products. The useful distinction is between a hot standby, a replica serving reads that's ready for failover, and a warm or cold standby, which must catch up or start before it can take over.

Strong consistency vs consensus. Consensus (Raft, Paxos) is one mechanism for providing strong consistency in a replicated system. Strong consistency is the guarantee. A single-node database gives strong consistency with no consensus at all. Conversely, a consensus-based system can still serve stale reads from followers unless reads also go through the leader or a quorum.

Deep Dive: Estimation mathematics beyond the formulasShow

Where peak factors come from.

  • Diurnal traffic. Traffic for a single-region consumer app follows a rough daily curve, with an evening peak around 2× the 24-hour average and a night trough well below it.
  • Global products flatten the curve, because time zones overlap. Event-driven products spike: a ticket on-sale, a product drop or a sports final can bring 10–100× the average within seconds.
  • Use the right factor. Use 2–3× for organic traffic and an explicit spike multiplier for events, and design admission control (waiting rooms, rate limits) for the part of the spike you choose not to provision for.

Why percentiles, and the tail at scale.

  • The fan-out effect. If one backend call has a 1% chance of being slow (above its p99), a page that fans out to 100 such calls in parallel is slow whenever any of them is. That probability is 1 − 0.99¹⁰⁰ ≈ 63%.
  • In "The Tail at Scale" (2013), Jeffrey Dean and Luiz André Barroso made this the central argument for treating tail latency as a first-class design concern. Their mitigations were hedged requests (send a backup request after the p95 delay), tied requests, and micro-partitioning so slow servers can shed work.
  • The estimation lesson. A page's latency budget must be split across its fan-out using per-call p99s, not averages.

Little's law and the utilisation knee.

  • Little's law (L = λW) holds for any stable system, whatever the arrival or service distribution, which makes it the most dependable formula in capacity planning. Example: a service handles 2,000 req/s at 50 ms each, so about 100 requests are in flight. With 8 worker threads per instance, that needs at least 13 instances, and more for headroom.
  • Queueing delay rises steeply. For a simple single-server queue with random arrivals, time in system = service time ÷ (1 − ρ), where ρ is utilisation:
    • at ρ = 50%, about 2× the service time;
    • at 80%, 5×;
    • at 90%, 10×;
    • at 95%, 20×.
  • Real systems target 50–70% steady-state utilisation. That leaves room to absorb a lost instance and a traffic spike without falling off this curve (Capacity Planning and Load Testing).

Availability arithmetic, and its main assumption.

  • The formulas. A chain multiplies: three 99.9% services in series give about 99.7%, roughly 26 hours of downtime a year instead of 8.8. Redundancy adds nines: two 99% replicas give 1 − 0.01² = 99.99%, if failures are independent.
  • The assumption usually fails. Replicas share a deploy pipeline, a config system, a region, a DNS provider or a bug, so correlated failures dominate real outages.
  • That's why HA design adds three things. Independent failure domains (zones, regions, cells), staggered deploys, and dependency minimisation on the critical path (Designing for High Availability).

Storage estimation details people miss:

  • Replication factor (usually 3×).
  • Index overhead (often 20–50% for OLTP tables).
  • Write amplification and compaction headroom in LSM stores (keep 30–50% of disk free).
  • Backups and snapshots, including point-in-time logs.
  • Derived copies: search indexes, caches, warehouse tables, ML features.

A dataset that is "100 TB of raw data" often occupies 400–600 TB of provisioned storage across all its copies. Compression pushes the other way: columnar formats compress logs and events 5–10×.

Cache sizing beyond 80/20.

  • Zipf-like popularity. Popularity in real systems often follows a heavy-tailed distribution. With such skew, a cache holding the top 1% of items can serve a large share of reads, but the curve flattens: each extra gigabyte buys fewer hits.
  • Measure the curve. The practical method is to replay a sample of real access logs against simulated cache sizes and plot the hit-ratio curve, then pick the knee. Without data, use 80/20 and say it's an assumption.

Estimation sanity checks.

  • Per-server load. Does peak QPS per server land in a believable range: thousands per app server, tens of thousands per cache node?
  • Bandwidth. Does egress fit the NICs and the budget? 1 GB/s of sustained egress is about 2.6 PB a month, which is expensive without a CDN.
  • Fit on one machine. Does the working set fit in RAM on one machine? If it does, half the distributed design may be unnecessary.
Deep Dive: Where the latency and capacity numbers come fromShow

Memorised numbers stick better when you know the physics behind them.

Speed of light in fibre.

  • About 200,000 km/s, two-thirds of its speed in a vacuum, or about 5 µs per km. New York to London is about 5,600 km, so the theoretical minimum round trip is about 56 ms. Real paths aren't straight and add switching, so 70–80 ms is typical.
  • No engineering can beat this. Cross-region latency can only be hidden: by caching at the edge, placing data near users, or avoiding synchronous cross-region calls on the critical path (Multi-Region and Global Data).

Handshakes multiply RTTs.

  • A cold HTTPS request costs a TCP handshake (1 RTT), a TLS 1.3 handshake (1 RTT), then the request itself (1 RTT): 3 RTTs before the first byte of the response. At 100 ms RTT, that's 300 ms of pure physics.
  • Avoiding them. Connection reuse (keep-alive, pooling), TLS session resumption, QUIC's combined handshake (0–1 RTT) and edge termination close to users all exist to remove those round trips (HTTP, HTTP/2, HTTP/3 and HTTPS).

Disks.

  • HDDs are mechanical: a random read needs a seek and rotational delay of about 5–10 ms, so one drive manages about 100–200 random IOPS. Sequential throughput is about 200 MB/s. That's why log-structured, append-only designs (LSM trees, Kafka) were invented: they turn random writes into sequential ones.
  • SSDs have no moving parts. NVMe drives do hundreds of thousands of random IOPS at tens of microseconds, and several GB/s sequentially. They still write in pages and erase in larger blocks, so write amplification and wear still matter (Storage Engines: B-Trees vs LSM Trees).

Memory.

  • DRAM access takes about 100 ns. A modern server's memory bandwidth is on the order of 100+ GB/s across channels.
  • Why Redis is fast. It serves most operations from memory with a single-threaded event loop and no locking: the cost is mostly the network round trip (~0.2–1 ms in a zone), not the lookup (~1 µs). Pipelining and batching amortise that round trip (Redis in Practice).

Network interfaces.

  • 25 Gbps is about 3 GB/s. A server pushing 2 MB images saturates its NIC at about 1,500 images/s, long before its CPU is busy. That's why media is served from object storage and CDNs, not app servers (Pattern: Handling Large Files and Blobs).
  • Between zones, bandwidth is plentiful, but providers often bill per GB.

Why a relational database handles more than people think.

  • Small indexed lookups are cheap. A primary-key lookup on a warm B-tree is a few in-memory page reads (microseconds). Most of a ~1 ms query's time is protocol, parsing and network.
  • Writes are bounded by the WAL. Their ceiling is WAL flush throughput and lock contention. Group commit batches many transactions into one fsync, which is how a single primary sustains thousands to tens of thousands of small write transactions per second on NVMe.
  • Use the numbers before sharding. Large tables of several TB are routine on modern hardware with good indexes and partitioned tables (Database Performance and SQL Tuning).

Connection limits.

  • WebSocket servers are memory-bound. Each idle connection costs kernel buffers plus application state, from a few KB to tens of KB, so a host with tens of GB of RAM can hold hundreds of thousands of idle connections if the application keeps per-connection state small.
  • CPU follows message rate, not connection count. Broadcasting one message to many connections is the expensive operation (Polling, Long Polling, SSE, WebSockets and Webhooks).

Relative costs (directional, since prices vary by provider and change over time).

  • Per GB-month: RAM costs far more than SSD, which costs several times more than standard object storage, which costs several times more than archive tiers.
  • Network: internet egress is charged per GB and can exceed storage costs for media-heavy products.
  • The design consequence: keep only the hot working set in memory, tier cold data down, and cache close to users so bytes leave the origin once (Data Lifecycle, Tiering and Retention).

Key Takeaways#

  • Requirements first. Pin 3–5 core actions, then scale, the read/write ratio, latency percentiles, consistency per data type, availability and durability, before drawing a single box.
  • Estimate to decide. QPS = daily actions ÷ ~10⁵, times a peak factor. Storage = items × size × retention × replication. Every number should end in "…so the design needs X" or "…so it doesn't".
  • Use modern hardware numbers: hundreds of GB of RAM per server, tens of TB of SSD, 25–100 Gbps NICs, sub-millisecond in-zone RTTs, 50–150 ms across regions. They prevent premature sharding and needless caches.
  • Pick components from needs. Start with load balancer, stateless servers and one relational database. Add caches, queues, streams, search, blobs and CDNs only when a requirement or number calls for them.
  • Most prompts are a known pattern: scaling reads, scaling writes, realtime updates, long-running tasks, contention, multi-step processes or large blobs. Name the dominant one early and plan your deep dive around it.
  • Precise vocabulary shows understanding. ACID consistency isn't CAP consistency, a network partition isn't a shard, and exactly-once processing isn't exactly-once delivery.
  • Tail latency and correlated failures are where simple arithmetic misleads. Fan-out amplifies p99s, and redundancy only adds nines when failures are independent.
  • The cheat sheet is a map, not the territory. Every glossary term links to the page with the mechanisms, trade-offs and failure modes that interviewers and production actually test.