System design concepts
Interviewers expect you to use these ideas. Each page tells you how the idea works, the trade-offs to say out loud, the common mistakes and the questions that use it.
Scaling and architecture
- Back-of-the-envelope estimationBack-of-the-envelope estimation uses simple arithmetic and clear assumptions to estimate the resources a system needs.
- Load balancingLoad balancing distributes new connections or requests across multiple servers.
- Database shardingDatabase sharding splits a dataset across database instances.
- Consistent hashingConsistent hashing assigns keys to servers and limits assignment changes when servers join or leave.
- Partitioning strategiesPartitioning divides data or work into smaller groups.
- Database replicationDatabase replication keeps copies of the same data on multiple database nodes.
- Hot keys and hot partitionsA hot key receives more traffic than its node can handle.
- Content delivery networks (CDN)A content delivery network (CDN) serves content through edge servers in different geographic areas.
- AutoscalingAutoscaling automatically adjusts compute capacity as demand changes.
- Load sheddingLoad shedding deliberately rejects or drops selected work when a system cannot safely handle all requests.
- Multi-region architectureMulti-region architecture runs a service across separate geographic regions to reduce user latency, survive regional outages, or meet data residency requirements.
- Multi-tenancyMulti-tenancy lets multiple customers or organizations use a shared application.
- Stateless servicesA stateless service does not depend on one instance to remember a client's previous requests.
- Microservices architectureMicroservices architecture divides an application into services that teams can deploy independently.
- Service discoveryService discovery maps a stable service name to instance addresses that change.
- API gatewayAn API gateway is an entry point for clients that routes API requests to backend services.
- Reverse proxyA reverse proxy accepts client requests for backend servers, sends them to those servers, and returns the responses.
- Service meshA service mesh is an infrastructure layer that manages communication between services.
Storage and databases
- SQL vs NoSQLSQL vs NoSQL compares data models, query capabilities, and operational guarantees, not just tables and documents.
- Database indexingA database index is an extra data structure that helps the database find rows without a full table scan.
- B-treesA B-tree is a balanced search tree that keeps keys sorted in pages.
- LSM treesAn LSM tree, or log-structured merge tree, holds writes in memory and periodically writes sorted files to disk.
- Write-ahead logA write-ahead log (WAL) records database changes in durable storage before the database writes the related data pages.
- MVCCMVCC means multi-version concurrency control.
- Transaction isolation levelsTransaction isolation levels define which effects a transaction can see from concurrent transactions.
- Two-phase lockingTwo-phase locking (2PL) is a database concurrency-control protocol.
- Optimistic lockingOptimistic locking prevents a writer from silently replacing changes made after it read a record.
- DenormalizationDenormalization stores duplicate or derived data on purpose so common reads need less work.
- Materialized viewsA materialized view stores query results so reads do not repeat expensive joins, scans, or aggregations.
- Columnar storageColumnar storage groups values from the same column instead of complete rows.
- Time-series databasesA time-series database stores measurements with timestamps and supports efficient time-range queries and aggregates.
- Object storageObject storage, also called blob storage, stores files as objects with keys instead of disk blocks or filesystem paths.
- Erasure codingErasure coding stores data fragments and computed recovery fragments.
- Data deduplication and chunkingChunking splits a file into smaller pieces.
- Write amplificationWrite amplification is the extra data a system writes for each logical write from an application.
- Connection poolingConnection pooling reuses a limited set of open connections instead of creating a new connection for each database operation.
- Change data captureChange data capture (CDC) turns committed database changes into a stream for other systems.
- Schema evolutionSchema evolution changes the structure or meaning of stored data, API payloads, or events without harm to systems that use them.
- Serialization formatsSerialization formats convert structured data into bytes that services can send, store, and later decode.
- Data lakes and warehousesA data lake keeps large amounts of data, often as files in object storage, for flexible use and reuse.
Caching
- Caching strategiesCaching strategies define which data stays near readers, how it enters the cache, and how it stays fresh after source changes.
- Cache invalidationCache invalidation removes or replaces cached data when the source of truth changes.
- Cache stampede and thundering herdA cache stampede occurs when many requests miss the cache at once.
- LRU and cache evictionCache eviction selects entries to remove when a cache has no space.
Search and indexing
- Inverted indexAn inverted index maps each searchable term to the documents that contain it.
- Full-text searchFull-text search finds documents through words in their content and orders matches by relevance.
- Tries and typeaheadA trie is a tree that shares prefixes across strings.
- Vector databases and ANN searchA vector database stores embeddings and finds items with similar vectors.
Consistency and consensus
- CAP theoremThe CAP theorem says a distributed data system cannot guarantee both linearizable consistency and availability for every request during a network partition.
- Eventual consistencyEventual consistency lets replicas or derived views differ temporarily.
- LinearizabilityLinearizability makes operations on shared state act as if they occur one at a time.
- SerializabilitySerializability guarantees that concurrent transactions have the same effect as some sequence of transactions that run one at a time.
- Causal consistencyCausal consistency preserves the order of operations that depend on each other.
- Read-your-writes and session guaranteesSession guarantees keep a user's data view consistent across requests, even when replicas update asynchronously.
- QuorumsA quorum is the set or number of replica responses that a protocol requires before an operation can succeed.
- Read repair and anti-entropyRead repair and anti-entropy make replicas agree after missed writes, outages, or network partitions.
- Consensus algorithmsA consensus algorithm lets distributed nodes agree on a decision despite failures and message delays.
- RaftRaft is a consensus algorithm that keeps a replicated log consistent across servers despite crashes and network partitions.
- PaxosPaxos is a consensus algorithm that lets nodes agree on one value despite crashes, message delays, and network partitions.
- Leader electionLeader election chooses one node to coordinate a specific job, such as writes for a partition or work schedules.
- Gossip protocolA gossip protocol spreads information through repeated node exchanges with a few peers, often selected at random.
- Heartbeats and failure detectionHeartbeats are regular messages that check whether a process, server, or client remains reachable.
- Split brainSplit brain occurs when multiple nodes or groups each claim sole authority for the same resource, often after they lose contact.
- Vector clocksVector clocks record causal history.
- Lamport clocksA Lamport clock uses a logical counter to order events without synchronized wall clocks.
- Hybrid logical clocksA hybrid logical clock (HLC) combines a physical-time value with a logical counter to timestamp distributed events.
- Clock skew and time in distributed systemsClock skew is the difference between clock values on different machines at the same instant.
- CRDTsConflict-free replicated data types (CRDTs) let replicas accept updates independently and converge with predefined merge rules.
- Operational transformationOperational transformation (OT) is an algorithm for shared edits.
- Conflict resolution and last-write-winsConflict resolution decides what happens when replicas or offline clients make competing updates to the same data.
- Merkle treesA Merkle tree uses hashes to summarize a dataset.
Transactions and correctness
- Idempotency and idempotency keysIdempotency means repeated attempts at the same operation have the same intended effect as one attempt.
- Distributed transactionsA distributed transaction coordinates changes across multiple databases, shards, or services so all participant writes commit or abort together.
- Two-phase commitTwo-phase commit (2PC) coordinates one atomic transaction across multiple databases or other transactional participants.
- Saga patternThe saga pattern coordinates a business operation across services through a sequence of local transactions.
- Transactional outbox patternThe transactional outbox pattern saves a business change and its outgoing event in the same database transaction.
- The dual-write problemThe dual-write problem occurs when one logical operation must update two independent systems without a shared atomic transaction.
- Exactly-once processingExactly-once processing gives each logical event one committed effect within a defined boundary, even when workers retry or messages arrive more than once.
- Delivery guaranteesDelivery guarantees describe message loss, repeat delivery, or exactly one committed effect when failures occur.
- Distributed locks and fencing tokensA distributed lock gives one process exclusive access to a resource, usually through a lease with a time limit.
Messaging and streaming
- Message queuesA message queue holds work until a consumer can process it.
- Kafka vs RabbitMQKafka usually fits retained event streams that multiple applications read independently.
- Publish-subscribePublish-subscribe, or pub-sub, lets a producer publish an event without knowing which consumers will receive it.
- Dead-letter queuesA dead-letter queue (DLQ) stores messages that fail after a defined retry policy or need intervention to succeed.
- Delay queues and scheduled deliveryA delay queue stores messages until a specified time, then makes them available for a worker to process.
- Priority queues in distributed systemsA priority queue selects eligible work by importance, not arrival time.
- Message orderingMessage ordering defines which messages a system must observe or apply first, and within which scope.
- Stream processingStream processing continuously changes new events into useful outputs, such as live counts, alerts, or updated recommendations.
- Windowing and watermarksWindowing divides an unbounded event stream into finite groups for counts, aggregation, and joins.
- BackpressureBackpressure is feedback that makes a producer slow when a downstream consumer cannot match its rate.
- Event-driven architectureEvent-driven architecture connects components through events.
- Event sourcingEvent sourcing stores accepted changes as an ordered event history.
- CQRSCQRS means command query responsibility segregation.
- Fan-out on write and on readFan-out on write prepares each recipient’s feed when an author publishes content.
- WebhooksA webhook sends an HTTP request to a registered endpoint when an event occurs, such as a payment settlement.
- WebSockets, SSE and long pollingWebSockets, Server-Sent Events (SSE), and long polling let clients receive updates without repeated checks for changes.
- Workflow orchestrationWorkflow orchestration coordinates a process with multiple steps and durably records progress.
- Distributed cron and job schedulingDistributed cron and job scheduling runs work at set times across multiple machines, even when schedulers or workers fail.
Reliability and operations
- Circuit breakersA circuit breaker temporarily stops calls to a dependency that appears unhealthy.
- BulkheadsThe bulkhead pattern divides resources into isolated pools.
- Retries, backoff and jitterRetries give an operation another chance after a temporary failure.
- FailoverFailover moves service responsibility from a failed or unreachable component to a healthy replacement.
- Blue-green deploymentBlue-green deployment uses two application environments that can serve production traffic.
- Canary deploymentA canary deployment sends a small share of production traffic or workloads to a new version before it expands the release.
- Feature flagsFeature flags change application behavior without new code deployments.
- ObservabilityObservability lets you understand a system's internal behavior from its signals.
- SLIs, SLOs and SLAsAn SLI measures service behavior.
- Distributed tracingDistributed tracing follows a request or workflow across services through linked operations called spans.
- Log aggregationLog aggregation collects logs from many application instances into a shared system to search records and investigate failures.
- Chaos engineeringChaos engineering uses controlled failure experiments to check whether a system behaves as expected when a component fails.
- Disaster recovery, RPO and RTODisaster recovery is a plan to restore a service and its data after a major failure.
- Zero-downtime migrationsZero-downtime migrations change a database schema or move data while the application continues to serve requests.
- Strangler fig patternThe strangler fig pattern replaces an existing system in parts while the old and new implementations run together.
APIs, networking and security
- REST API designREST API design defines how clients address resources, read resource representations, and request changes through HTTP semantics.
- GraphQLGraphQL is a typed API query language and execution model.
- API versioningAPI versioning lets a service change its public contract without unexpected failures in existing clients.
- PaginationPagination splits a large result set into responses with size limits.
- Rate limiting algorithmsRate limiting algorithms accept or reject requests based on a set traffic budget, such as requests per second per account.
- Unique ID generationUnique ID generation gives each record or event an identifier without accidentally giving the same value to another item.
- DNSDNS is a distributed name system that maps names, such as api.example.com, to records, such as IP addresses.
- TLS and HTTPSHTTPS is HTTP with TLS protection.
- OAuth 2.0OAuth 2.0 lets an application access an API for someone without collecting their API password.
- JWTA JSON Web Token (JWT) carries claims, such as a user ID and expiration time, between systems.
- Access control and RBACAccess control decides whether a caller can perform an action on a resource.
- End-to-end encryptionEnd-to-end encryption (E2EE) encrypts content on the sender’s device.
- Audit logsAn audit log is a durable history of who did what, to which resource, when, and with what result.
- DDoS protectionDDoS protection keeps a service usable when many sources deliberately exhaust its bandwidth, connections, or application resources.
Location
- GeohashGeohash encodes latitude and longitude as a string that identifies a rectangular geographic cell.
- QuadtreeA quadtree is a spatial index that repeatedly divides a two-dimensional area into four smaller regions.
- S2 geometryS2 geometry is a library for shapes on a sphere.
- H3 hexagonal gridUber developed H3, an open-source geospatial index system that maps latitude and longitude to cells in a hierarchical, mostly hexagonal grid.
Probabilistic data structures
- Bloom filtersA Bloom filter is a compact data structure that tells whether a key is definitely absent or possibly present in a set.
- HyperLogLogHyperLogLog (HLL) estimates the number of distinct values in a dataset without storing every value.
- Count-min sketchA count-min sketch estimates how often a key appears in a stream without a counter for every key.
- Skip listsA skip list is a sorted linked structure with extra pointer levels that let searches skip many entries.
- Cuckoo filtersA cuckoo filter is a compact membership index.