System Design Interview Questions
State the invariant you need to preserve, estimate the workload and explain what can fail before naming infrastructure.
Try answering aloud before opening each explanation.
Try the System Design practice demoFoundations
What should you clarify before drawing a system diagram?
Ask who uses the system, the main operations and their required availability and latency. Identify what must never happen, such as a confirmed reservation being sold twice.
Why estimate peak traffic separately from daily traffic?
A daily average can hide bursts that overwhelm queues or connection pools. Estimate the busiest interval, read-to-write mix and request size, then check how sensitive the design is to each assumption.
How do a replication strategy and a partitioning strategy differ?
Replication creates copies of data for redundancy or reads. Partitioning divides the dataset so different nodes own different ranges. A system can do both by replicating each partition.
What does a stateless application tier make easier?
Any healthy instance can normally serve a request, so scaling and recovery do not depend on a particular process. Durable state still needs an external owner and failure policy.
What does p99 latency tell you that average latency does not?
It describes the threshold at or below which about 99% of observations fall. A small fraction of slow requests can be invisible in the average yet affect many real users.
Applied
Why can a well-distributed partition key still create a hotspot?
Keys can be evenly distributed while traffic is highly skewed. A popular item can overload the partition that owns it. Consider caching hot reads or splitting writes if the invariant allows it.
How would you provide read-your-writes after moving reads to replicas?
Read from the primary temporarily, or use a commit position and wait for a replica that has caught up. Define the fallback if the replica cannot meet the required position within the deadline.
When does an asynchronous job queue improve perceived latency?
It lets the user receive acceptance without waiting for processing. Expose status and errors separately, and enforce a backlog limit so a fast acceptance response does not hide a very long wait.
How would you limit cache stampedes when a popular entry expires?
Coalesce concurrent refreshes, stagger expirations and consider serving stale values if the product permits it. Preserve an upper freshness bound for data on which decisions depend.
When would you keep a materialized read model instead of querying the source of truth directly?
Use a projection when read latency or query shape justifies the extra representation. Define acceptable lag, how to rebuild it and what clients see while the projection is stale.
Production scenarios
What trades off when writes fail over between regions?
Synchronous replication can reduce loss at the cost of latency and availability during partitions. Asynchronous replication permits faster local commits but may lose recent writes on failover. Fence the old writer before accepting writes elsewhere.
How do recovery point and recovery time objectives shape backups?
Recovery point is tolerable data loss measured in time; recovery time is how long restoration may take. Backup and log-shipping frequency affect the former, while restore rehearsals and capacity planning establish the latter.
How does fan-out affect latency when a request waits for every dependency?
The slowest required response dominates. As fan-out grows, a rare slow dependency becomes more likely to affect any given request. Limit fan-out, use deadlines and make optional results genuinely optional.
What is load shedding and how do you choose what to shed?
Reject or defer work before saturation makes all requests fail. Protect the cheapest or highest-priority critical operations and bound queues. Communicate retry expectations so rejected work does not immediately return.
How would you prove a design can survive losing its largest node?
Check remaining headroom and run a controlled failure test under representative load. Observe failover time, queue growth and data invariants; healthy idle failover does not prove capacity at peak.
Further reading
Official documentation
Related question sets
- Node.js interview questions
- TypeScript interview questions
- REST API interview questions
- Microservices interview questions
- SQL interview questions
- Python interview questions
- JavaScript interview questions
- React interview questions
- Kubernetes interview questions
- Java interview questions
- Docker interview questions
- MongoDB interview questions
- PostgreSQL interview questions
- Redis interview questions
- NestJS interview questions
- RabbitMQ interview questions