System design comparisons
The choices interviewers ask you to defend, side by side: what actually differs, when each one wins, and how to argue it in the round.
- Active-active vs Active-passiveActive-active serves production traffic from multiple instances or regions at once; active-passive keeps a standby ready to take over.
- API gateway vs Load balancerAn API gateway applies API-level policies, while a load balancer distributes traffic across healthy backends.
- At-least-once vs Exactly-onceAt-least-once allows duplicate deliveries; exactly-once means each logical operation has one committed effect within a defined boundary, even if processing is retried.
- Avro vs ProtobufChoose Avro when writer-schema resolution, generic data processing, and replay across schema versions are central to your event pipeline.
- B-tree vs LSM treeChoose a B-tree when point reads, ordered scans, and predictable read latency are central; choose an LSM tree when sustained write throughput justifies compaction and more complex reads.
- Batch processing vs Stream processingBatch processing computes over a bounded dataset; stream processing continuously updates results as events arrive.
- Blue-green vs Canary deploymentBlue-green switches production traffic between two environments, while canary gradually exposes a new version to a subset of production traffic.
- Cache-aside vs Read-throughCache-aside puts cache lookup, database fallback, and cache population in application code; read-through delegates miss loading to a cache abstraction with a configured loader.
- Cassandra vs DynamoDBChoose Cassandra when deployment flexibility and control over replication, storage, and cluster operations justify running a distributed database.
- Cassandra vs MongoDBChoose Cassandra for write-heavy workloads with known, partition-oriented queries and a need to accept writes in multiple regions.
- CDN vs CacheA CDN is a geographically distributed delivery network that often caches HTTP content near users; a cache is the broader mechanism for reusing stored results.
- Choreography vs OrchestrationChoreography lets services react to events and decide their own next steps; orchestration gives an explicit coordinator responsibility for advancing a workflow.
- Clustered vs Non-clustered indexA clustered index stores table rows at the leaves of the index tree; a non-clustered index is a separate structure containing keys and row locators, sometimes with extra columns.
- Consistent hashing vs Rendezvous hashingChoose ring-based consistent hashing when a large node set makes per-request placement cost important; choose rendezvous hashing when simpler placement and replica ranking matter more than scanning all candidate nodes.
- Data warehouse vs Data lakeA data warehouse prioritizes curated data and predictable analytical queries; a data lake prioritizes flexible, durable storage for raw and processed datasets.
- DynamoDB vs MongoDBChoose DynamoDB when your access patterns are known, key-based, and suited to an AWS-managed service with automatic partition management.
- Elasticsearch vs PostgreSQL full-text searchChoose PostgreSQL full-text search when keyword search needs to work closely with relational filters, permissions, and transactional updates without another datastore.
- Elasticsearch vs SolrElasticsearch and Solr both build distributed search on Apache Lucene, so choose based on operational fit, query requirements, and licensing rather than assuming one is faster.
- Encryption vs HashingEncryption protects confidentiality while allowing authorized recovery of the original data; cryptographic hashing produces a one-way digest for comparison or verification.
- ETL vs ELTETL transforms data before loading it into the analytical destination; ELT loads source data first and transforms it inside that destination.
- Event sourcing vs CQRSEvent sourcing stores authoritative state as a sequence of events; CQRS separates the models used to change state from those used to query it.
- Fan-out on write vs Fan-out on readFan-out on write precomputes recipients' feeds when a post is published; fan-out on read assembles a reader's feed when requested.
- Flink vs Spark StreamingChoose Flink when continuous, low-latency processing and complex keyed state or event-time logic drive the design.
- Geohash vs H3Geohash is a rectangular spatial encoding with exact prefix-based subdivision; H3 is a mostly hexagonal grid with convenient neighborhood operations and a logical hierarchy.
- GraphQL vs gRPCChoose GraphQL when clients need flexible views that combine data across services; choose gRPC when callers need explicit service methods, generated clients, and native streaming.
- gRPC vs RESTChoose gRPC for controlled service-to-service APIs that benefit from generated clients, typed contracts, or bidirectional streaming.
- HLS vs DASHChoose HLS when native Apple-device playback is a requirement; choose DASH when your target players and DRM stack support it well and you want MPEG's standardized streaming format.
- Horizontal scaling vs Vertical scalingHorizontal scaling adds instances to spread work; vertical scaling gives an existing instance more CPU, memory, or I/O capacity.
- HTTP/1.1 vs HTTP/2HTTP/2 multiplexes concurrent requests over a TCP connection, while HTTP/1.1 typically needs multiple connections for concurrency.
- HTTP/2 vs HTTP/3HTTP/2 multiplexes requests over TCP; HTTP/3 uses QUIC over UDP so packet loss on one stream does not impose TCP-level blocking on every stream.
- JSON vs ProtobufChoose JSON when easy integration, human-readable payloads, and broad client support matter most.
- JWT vs SessionsChoose JWT access tokens when multiple services need to verify identity locally and a bounded delay in revocation is acceptable.
- Kafka vs KinesisChoose Kafka when you need deployment flexibility, a broad streaming ecosystem, and control over log configuration.
- Kafka vs PulsarChoose Kafka when a partitioned event log and its stream-processing ecosystem fit your requirements, especially if your team already operates it.
- Kafka vs SQSChoose Kafka when you need a retained event stream that independent consumers can read and replay.
- Lambda architecture vs Kappa architectureLambda architecture maintains separate batch and streaming paths, while Kappa uses one stream-processing path for both live events and historical replay.
- Latency vs ThroughputLatency measures how long one operation takes; throughput measures how much work a system completes per unit of time.
- Layer 4 vs Layer 7 load balancingLayer 4 load balancing routes transport flows using connection metadata; Layer 7 load balancing understands application requests and can route by HTTP host, path, or headers.
- Leader-follower vs Multi-leader replicationLeader-follower replication, often called master-slave, accepts writes through one leader per replication group; multi-leader replication, often called master-master, lets multiple leaders accept writes to the same data.
- Long polling vs WebSocketsLong polling delivers updates through repeated HTTP requests that wait for data; WebSockets keep a connection open for messages in both directions.
- LRU vs LFULRU evicts the least recently used entry; LFU evicts the least frequently used entry.
- MongoDB vs PostgreSQLChoose PostgreSQL when relationships, database-enforced constraints, and transactions across related records drive the design.
- Monolith vs MicroservicesA monolith deploys application modules together; microservices let services deploy and scale independently, at the cost of network calls and distributed coordination.
- MySQL vs MongoDBChoose MySQL when relationships, database-enforced constraints, and transactions across related records drive the design.
- Nginx vs HAProxyChoose Nginx when the same component needs to serve static files, cache HTTP responses, and reverse-proxy application traffic.
- Normalization vs DenormalizationNormalization organizes data around dependencies to reduce redundancy and update anomalies; denormalization deliberately duplicates or precomputes data for specific reads.
- OAuth vs SAMLOAuth 2.0 delegates access to APIs; SAML 2.0 commonly provides federated browser login through signed identity assertions.
- OLTP vs OLAPOLTP (online transaction processing) handles small, concurrent operations on current application state; OLAP (online analytical processing) scans and aggregates larger datasets to answer analytical questions.
- Optimistic locking vs Pessimistic lockingOptimistic locking detects conflicting changes before accepting a write; pessimistic locking acquires locks before making changes that depend on protected state.
- Polling vs WebhooksPolling lets the consumer check for changes on its own schedule; webhooks let the producer send an HTTP callback when something changes.
- PostgreSQL vs MySQLChoose PostgreSQL when richer constraints, specialized indexes, or extensions simplify your data model and queries.
- Pub/sub vs Message queueUse pub/sub when multiple independent consumers each need an event; use a message queue when a pool of workers should share responsibility for processing jobs.
- Push vs PullPush lets a sender deliver updates when they are available; pull lets a receiver request updates when it is ready.
- RabbitMQ vs SQSChoose RabbitMQ when broker-side routing, delivery control, or deployment outside AWS drives the design.
- Raft vs PaxosRaft specifies a leader-based replicated log; basic Paxos chooses one value, and Multi-Paxos extends that foundation to a sequence of decisions.
- Rate limiting vs ThrottlingRate limiting defines how much traffic is allowed; throttling controls how quickly traffic proceeds, sometimes by delaying work and sometimes by rejecting it.
- Redis vs DynamoDBChoose Redis for memory-resident caching, counters, and operations on structures such as sorted sets; choose DynamoDB for durable, managed key-value and document storage.
- Redis vs KafkaChoose Redis for fast shared state, caching, or lightweight messaging; choose Kafka for a retained event log with independent consumers and replay.
- Redis vs MemcachedChoose Redis when you need server-side data structures, atomic multi-step operations, or built-in replication and persistence options.
- Replication vs ShardingReplication keeps copies of the same data; sharding splits data into subsets that different servers own.
- REST vs GraphQLChoose REST for resource-oriented APIs where predictable operations and straightforward HTTP caching matter most.
- Reverse proxy vs Forward proxyA reverse proxy represents servers to clients; a forward proxy represents clients to destination servers.
- Row-oriented vs Columnar storageRow-oriented storage keeps a record's fields together, making it a strong default for indexed record lookups and frequent transactional updates.
- RPC vs RESTRPC models an API as callable operations; REST models it around resources and standard HTTP semantics.
- S3 vs EBSUse S3 for objects such as photos, videos, backups, and analytical datasets accessed through an API.
- Saga vs Two-phase commitA saga commits local transactions step by step and uses compensating actions when the workflow cannot finish; two-phase commit (2PC) coordinates one atomic commit decision across participating transactional resources.
- Serverless vs ContainersChoose serverless functions for short, event-driven work with variable demand; choose long-running container services when you need more control over execution, connections, or capacity.
- Sharding vs PartitioningSharding is a form of partitioning: it splits data across database nodes, while partitioning is the broader practice of dividing data into smaller pieces.
- Snowflake IDs vs UUIDsChoose Snowflake-style IDs when compact, roughly time-ordered 64-bit keys justify managing worker identities and clock behavior.
- SOAP vs RESTSOAP is an XML-based messaging protocol; REST is an architectural style built around resources and a uniform interface, usually implemented over HTTP.
- Spark vs Hadoop MapReduceSpark supports multi-stage batch processing, SQL, iterative computation, and streaming, while Hadoop MapReduce focuses on disk-oriented batch jobs.
- SQS vs SNSUse SQS to buffer work for consumers that pull and process messages at their own pace.
- Strong consistency vs Eventual consistencyStrong consistency, used here to mean linearizability, makes each operation appear atomic and respects the order of non-overlapping operations.
- Symmetric vs Asymmetric encryptionUse symmetric encryption to protect application data efficiently, and asymmetric cryptography to establish keys or authenticate parties without sharing a private key.
- Synchronous vs Asynchronous replicationSynchronous replication waits for the required replica acknowledgments before reporting write success; asynchronous replication reports success without waiting for remote replication.
- TCP vs UDPTCP provides a reliable, ordered byte stream; UDP provides independent datagrams without delivery or ordering guarantees.
- UUID vs Auto-increment IDsChoose UUIDs when independent services, regions, or offline clients must generate IDs without contacting a shared allocator.
- Vertical vs Horizontal partitioningVertical partitioning splits a table by columns; horizontal partitioning splits it by rows.
- WebSockets vs Server-Sent EventsChoose WebSockets for frequent, bidirectional communication over one connection, such as chat or collaborative editing.
- WebSockets vs WebRTCUse WebSockets for client-server messaging such as chat, notifications, and live application updates.
- Write-through vs Write-back cacheWrite-through waits for the backing store before acknowledging a write; write-back acknowledges from the cache layer and persists to the backing store later.
- ZooKeeper vs etcdZooKeeper centers on hierarchical coordination primitives; etcd centers on a versioned key-value API with transactions, leases, and revision-based watches.