System Design Senior interview questions and answers
75 questions for a System Design (Senior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.What does the CAP theorem state?
- 2.A user updated their profile, refreshed the page and saw the old data. Which guarantee was violated?
- 3.Why is choosing "creation date" as a sharding key dangerous?
- 4.Why use consistent hashing when adding cache nodes?
- 5.Why put a message queue between the API and a heavy-task worker?
- 6.Why must consumers of an "at-least-once" queue be idempotent?
- 7.What is backpressure?
- 8.How does fan-out on write differ from fan-out on read in a social feed?
- 9.How do you guarantee correct message order in a chat?
- 10.Which components are usually needed in a messenger architecture?
- 11.How do you scale WebSocket servers horizontally?
- 12.How do you implement an "online" status for millions of users?
- 13.How does OT differ from CRDT in collaborative editing?
- 14.How does adaptive video streaming (HLS/DASH) work?
- 15.How would you design serving user images in different sizes?
- 16.How do you implement rate limiting when the API runs on 20 servers?
- 17.What is a Bloom filter useful for?
- 18.How do you generate short links in a URL shortener?
- 19.How do you scale search suggestions (typeahead) to millions of requests per second?
- 20.What problems arise when running a service in multiple regions (active-active)?
- 21.Why is a
Vary: User-AgentorVary: Cookieheader dangerous for a CDN? - 22.What is a cache stampede and how do you prevent it?
- 23.How do cache-aside, write-through and write-back strategies differ?
- 24.When should you render at the edge, and when in a region near the database?
- 25.What ways of composing micro-frontends exist?
- 26.How do you deploy an API change without breaking clients on the old version?
- 27.Why do users get a
ChunkLoadErrorafter an SPA deploy? - 28.How do metrics, logs and traces complement each other?
- 29.What is an error budget?
- 30.What is the Bulkhead pattern?
- 31.Why is it important to look at p99 latency and not just the average?
- 32.How do you combine CDN caching of HTML with personalization (username, cart)?
- 33.Why can't a successful redirect from the payment page be treated as payment confirmation?
- 34.How do you verify the authenticity of an incoming webhook?
- 35.Why is the search index often updated asynchronously rather than in the same transaction?
- 36.How do you atomically update the database and publish an event to a queue?
- 37.A service must handle 10 million daily active users making 20 requests each. What is the average load?
- 38.How does designing a read-heavy system differ from a write-heavy one?
- 39.How do you build an analytics dashboard over millions of events so it opens quickly?
- 40.How would you design a notification system (email, push, in-app)?
- 41.How do you deliver the result of a heavy operation (a 5-minute report export)?
- 42.How can the frontend evaluate feature flags without UI flicker?
- 43.What should be minimized in logs and analytics for privacy?
- 44.Why are signed links to private files made short-lived?
- 45.How does designing for strong consistency differ for a bank balance versus a like counter?
- 46.What are hedged requests and when are they useful?
- 47.How do you keep the site working if the recommendations service is down?
- 48.How do you estimate storage requirements for 5 years of chat messages for 1M users?
- 49.How does active-passive failover differ from active-active?
- 50.Why should API responses for mobile clients be designed with long-lived old versions in mind?
- 51.Is "exactly-once" message delivery achievable in a distributed system?
- 52.One celebrity account gets millions of writes, overloading its partition. What helps?
- 53.What are common options for tenant isolation in a multi-tenant SaaS?
- 54.What data structure makes full-text search fast?
- 55.How are metrics with billions of points stored cheaply?
- 56.How would you implement a real-time game leaderboard?
- 57.What does a Snowflake-style ID provide over random UUIDv4?
- 58.In a replicated store with N=3, why choose R=2 and W=2?
- 59.Why is two-phase commit rarely used across microservices?
- 60.What is load shedding?
- 61.Why do serverless functions show latency spikes after idle periods?
- 62.After a WebSocket server outage, all clients reconnect at once and knock it over again. How do you prevent this?
- 63.Why do payment systems use an append-only double-entry ledger instead of a mutable
balancecolumn? - 64.How can you honor "right to be forgotten" requests when personal data lives in immutable event logs and backups?
- 65.How do you rename a database column without downtime?
- 66.What do RPO and RTO mean in disaster recovery?
- 67.What is chaos engineering?
- 68.How do data residency requirements (e.g. EU data stays in the EU) affect architecture?
- 69.1M video views per day at 50 MB each - roughly what average egress bandwidth is needed?
- 70.A service handles 1,000 requests/s with an average latency of 200 ms. How many requests are in flight on average?
- 71.Why does a distributed lock need fencing tokens?
- 72.What is Change Data Capture (CDC) used for?
- 73.A dashboard runs a heavy aggregation on every page load. What is a common fix?
- 74.How do you evolve event or message schemas without breaking consumers?
- 75.Why can sticky routing of WebSocket users to a server complicate deploys?