System Design

System Design

10 canonical prompts · 31 building blocks

Prompts

Sorted by interview frequency

Concepts

Storage

6

Relational DB (SQL)

ACID, joins, secondary indexes; vertical scale + read replicas.

Key-Value Store

O(1) get/put by key; massively scalable (DynamoDB, Redis, Cassandra).

Document Store

Flexible JSON-like documents with secondary indexes (MongoDB, Couchbase).

Wide-Column Store

Sparse rows over many columns; time-series friendly (Cassandra, HBase, Bigtable).

Object Storage (Blob)

Cheap durable storage for large immutable blobs (S3, GCS).

Search Index

Inverted index for full-text search and faceting (Elasticsearch, OpenSearch).

Caching & Edge

5

Cache-Aside (Lazy Loading)

App reads cache first; on miss, loads from DB and populates cache.

Write-Through Cache

Writes go to cache and DB synchronously — strong consistency, slower writes.

Write-Back Cache

Writes hit cache, flushed to DB later — fast but risks data loss.

CDN

Edge-cached static (and sometimes dynamic) content close to users.

Bloom Filter

Probabilistic set membership — no false negatives, tunable false positives.

Communication

7

Load Balancer

Distribute requests across healthy backends (L4 or L7).

API Gateway

Single entry point: auth, rate limit, routing, transformation.

Message Queue

Decouple producers/consumers; buffer bursts; enable retries (SQS/RabbitMQ).

Pub/Sub

Fan-out events to many subscribers; topic-based (Kafka, SNS, Redis pub/sub).

WebSockets

Persistent bidirectional connection for low-latency push to clients.

Long Polling

Client holds an HTTP request open until server has data; fallback to WebSockets.

Service Mesh

Sidecar proxies handle service-to-service auth, observability, retries.

Distribution & Coordination

7

Consistent Hashing

Distribute keys across nodes with minimal remapping on resize.

Sharding

Partition data across DB instances by key (hash, range, or geography).

Replication

Copy data across nodes for availability and read scaling (sync or async).

Leader Election

Pick a single coordinator (Raft/Paxos/ZooKeeper) for ordered decisions.

Change Data Capture (CDC)

Stream DB row changes (Debezium → Kafka) to downstream indexes/caches.

Geohash

Encode lat/lng into a string prefix for proximity bucketing/indexing.

Quadtree / R-Tree

Spatial index for range queries (find all points in a region).

Reliability

3

Rate Limiting

Throttle requests per user/IP with token bucket, leaky bucket, or sliding window.

Circuit Breaker

Stop calling failing dependencies; fail fast and recover gracefully.

Bulkhead

Isolate resource pools so one failing dependency can't sink the whole service.

Architecture

3

Saga Pattern

Coordinate distributed transactions via compensating actions, not 2PC.

Two-Phase Commit (2PC)

Atomic commit across nodes — strong consistency, blocks on failure.

Event Sourcing

Persist state as an append-only log of events; derive views by replay.