FreeExam

Backend system design

A senior backend engineer interview on designing services and data stores that scale, stay consistent, and degrade gracefully under failure.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.You are asked to design the backend for a ride dispatch service in a 45 minute interview. What do you ask about first?

  2. 2.You are designing a concert ticket sale. The interviewer says it must never oversell. Which follow-up question changes the design the most?

  3. 3.For a code review tool, the product manager asks for real-time comments. What should you clarify before choosing a design?

  4. 4.You are designing a payroll export that sends salary files to banks. Which non-functional requirement should you pin down early?

  5. 5.The prompt is only "design a recipe app backend," and you have 45 minutes. What is the best way to scope the session?

  6. 6.You are designing a clinic booking system. Which question best reveals how strong the consistency needs to be?

  7. 7.Designing a news feed, you learn that reads outnumber writes 100 to 1 and that a few seconds of staleness is fine. What does this point you toward?

  8. 8.A photo backup app has 50 million users. Each uploads 4 photos a day on average, and photos average 3 MB. About how much new storage is needed per day, before replication?

  9. 9.A chat app has 20 million daily active users who each send about 40 messages a day. What is the average message write rate?

  10. 10.A sensor dashboard ingests from 200,000 sensors. Each sends a 200 byte reading every 10 seconds. About how much raw data arrives per day?

  11. 11.A link preview service wants to cache its 10 million hottest entries. Each value is about 1 KB, plus roughly 100 bytes of key and overhead. How much memory does the cache need?

  12. 12.A video lesson platform expects 100,000 concurrent viewers, each streaming at 5 megabits per second. What egress bandwidth is needed at peak?

  13. 13.A checkout service handles 2,000 requests per second, and each request takes 150 ms on average. If each worker handles one request at a time, about how many workers must be busy at once?

  14. 14.A ticket sale expects 2 million users in the first 10 minutes, each making about 5 requests. Which load estimate should you design for?

  15. 15.A clinic records system adds 5 TB of new data per year. Data is stored with 3 replicas and kept for 7 years. How much raw disk is needed at the end of year 7?

  16. 16.A topic peaks at 12,000 messages per second, and one consumer instance processes about 500 per second. How should you set the partition count?

  17. 17.Forty app pods each open a database pool of 50 connections. The Postgres server allows 500 connections. What happens when the team scales out, and what is the fix?

  18. 18.A service handles 3,000 requests per second, and each request writes about 2 KB of logs. How much log data is that per day?

  19. 19.A newsletter sender receives 10,000 jobs per second, but its workers finish only 7,000 per second. How large is the backlog after one hour?

  20. 20.An upstream page calls 20 backends in parallel and waits for all of them. Each backend is slow on 1 percent of calls. About what share of page loads hit at least one slow call?

  21. 21.You are designing a wallet for in-game currency. Balances must never go negative, and each transfer touches two accounts. Which store fits best?

  22. 22.A sensor dashboard stores readings by time, queries them by sensor and time range, and deletes them after 90 days. Which layout fits best?

  23. 23.A chat app stores billions of messages in a wide-column store. The main read is the latest 50 messages in a conversation. Which key design fits?

  24. 24.In a photo backup app, where should the photo bytes and the photo metadata live?

  25. 25.Users of a recipe app want to search by ingredient with typo tolerance and ranking. Postgres is the source of truth. What do you add?

  26. 26.A business invoicing tool has 20,000 tenants. Most are tiny, and a few are very large. Which tenancy model is a sound default?

  27. 27.A team wants event sourcing for an internal room booking tool with a few hundred users and simple edits. What is the senior take?

  28. 28.An order system creates ids on many nodes without coordination, and the ids should sort roughly by time. Which scheme fits?

  29. 29.Analysts run heavy reports on the primary Postgres database of a clinic booking system, and bookings slow down. What is the best fix?

  30. 30.Ninety percent of a news site's traffic is logged-out readers, who all see the same article pages. Where do you cache first?

  31. 31.During a limited sneaker release, one product key gets 200,000 reads per second and overloads the single Redis shard that holds it. What helps most?

  32. 32.A service uses cache-aside and deletes the cache key on each write. A slow reader can still put an old value back after a write. What limits the damage?

  33. 33.A recipe app's database handles 5,000 reads per second. Traffic is 60,000 reads per second, with a 95 percent cache hit rate. What happens if the cache restarts empty?

  34. 34.A code search tool's cache hit rate drops from 99 percent to 98 percent. What happens to the load on the backing store?

  35. 35.A mobile game leaderboard gets frequent score updates. Losing a few seconds of scores in a crash is acceptable. Which caching pattern fits?

  36. 36.An online store shows stock counts on product pages from a cache. How should checkout use stock?

  37. 37.A weather widget's upstream provider is down for 20 minutes. Which cache policy keeps the widget useful?

  38. 38.A notes app shards by tenant. One tenant grows to 40 percent of all traffic. What do you do?

  39. 39.A food delivery app shards its orders table by the month each order was created. What problem appears?

  40. 40.Why use consistent hashing or many fixed virtual buckets instead of hash(key) mod N for placing data?

  41. 41.A video site's like counter for one viral post gets 50,000 increments per second, all on one database row. What is the fix?

  42. 42.An app shards users by user id. Email addresses must be unique across all shards. How do you enforce that?

  43. 43.A service shards users by user id across 64 shards. Login must find a user by phone number at 5,000 requests per second. What do you build?

  44. 44.A ride dispatch service shards by city. One large city now exceeds what a single shard can handle. What do you change?

  45. 45.You need 8 database shards today and might need 60 in five years. How do you set up the sharding scheme?

  46. 46.Payment events are keyed by merchant id. One merchant produces 30 percent of events, and its partition falls far behind. Per-merchant order is not needed. What do you change?

  47. 47.A real-estate listing app makes thumbnails inside the photo upload request, and 99th percentile upload latency is 8 seconds. What do you change?

  48. 48.Password reset emails sit behind a bulk marketing blast in the same queue and arrive an hour late. What is the fix?

  49. 49.A webhook service delivers events to customer endpoints. Some endpoints are down for hours. How should retries work?

  50. 50.An order triggers email, analytics, loyalty points, and a fraud check. Checkout calls all four synchronously and fails if any fail. What is the better design?

  51. 51.What should drive autoscaling for a fleet of job workers that read from a queue?

  52. 52.A payroll export runs three steps over two hours: compute, build files, and upload to the bank. Workers sometimes die partway through. How should you run it?

  53. 53.A news feed uses fan-out on write. An account with 30 million followers posts. How should the design handle accounts like this?

  54. 54.An order service saves a charge as pending, then calls a card processor. The call times out. What state should the record move to?

  55. 55.A consumer uses Kafka transactions for exactly-once processing and sends an email for each message. Does that make the email exactly-once?

  56. 56.A mobile payments API keeps idempotency keys so retries are safe. Clients may retry for up to 24 hours. How long should keys be kept?

  57. 57.Field sensors retry uploads over poor networks, so the ingestion service gets duplicate readings. How do you make writes idempotent?

  58. 58.A shipping provider's webhooks can arrive out of order, so delivered sometimes comes before in transit. How should your service apply them?

  59. 59.A referral program gives a one-time sign-up bonus when an event arrives, and events can be delivered more than once. How do you ensure each user gets one bonus?

  60. 60.A notes app lets users create notes offline and syncs them later. Sometimes a sync is sent twice. How should creation work?

  61. 61.A travel booking flow reserves a flight, a hotel, and a car through three partner services. The car step fails. What should happen?

  62. 62.A team moved profile reads to replicas. Users who just edited their profile sometimes see the old version. What is a targeted fix?

  63. 63.An order service writes each item to Postgres and then to a search index in the same request. Some items are missing from search. What is the fix?

  64. 64.A profile service emits UserUpdated events. A consumer sometimes applies an older update after a newer one. What is the fix?

  65. 65.Two regions serve a shopping cart. A network split cuts them off from each other. What should cart writes do?

  66. 66.A ferry booking service runs in two regions. A network split cuts them off. Should both regions keep selling seats for the same sailing?

  67. 67.Two services write directly to the same customers table, and their changes keep clashing. What is the better design?

  68. 68.Two services stamp events with their own local clocks, and a consumer orders events by timestamp. Why is this risky?

  69. 69.A ticket sale opens for 50,000 seats, and 2 million users arrive at once. What protects the system and stays fair?

  70. 70.One tenant's batch import floods a shared API, and other tenants see timeouts. What is the fix?

  71. 71.A food delivery app is overloaded at dinner time. Which requests should it shed first?

  72. 72.An API enforces 1,000 requests per second per key across three regions. A central Redis counter adds 80 ms for the far regions. What is a good design?

  73. 73.The Redis cluster behind an API's rate limiter goes down. What should the limiter do?

  74. 74.Under load, a server's queue grows. Clients give up after 2 seconds, but the server still processes their requests. What should change?

  75. 75.A checkout request depends on four services in a chain, all required. Each is 99.9 percent available. About how available is checkout?

  76. 76.The recommendations service goes down, and the whole product page fails with it. What is the right design?

  77. 77.A booking service calls five partner APIs through one shared thread pool. One slow partner ties up every thread, and all endpoints stall. What helps most?

  78. 78.A service's Kubernetes liveness probe checks the database. During a brief database blip, every pod restarts at once. What is the fix?

  79. 79.A bad configuration change pushed to all 300 hosts of a chat app at once takes the service down. What process change prevents a repeat?

  80. 80.A search service scatters each query to 50 shards, and p99 latency is set by the slowest shard. What improves it most?

  81. 81.An inventory service comes back after a 10 minute outage and is knocked over again by a flood of queued retries. What should you add?

  82. 82.A service runs active-passive across two regions with asynchronous replication. The primary region fails. What data can be lost?

  83. 83.For a small-business accounting ledger, the product team says no committed entry may be lost and service must return within one hour. What does that mean for the recovery point objective (RPO) and recovery time objective (RTO)?

  84. 84.A notes app runs active-active in two regions, and the same note can be edited in both at once. What must the design include?

  85. 85.A clinic system expands to the EU, and patient health data must stay in the EU. How should you design for this?

  86. 86.Two regions are 70 ms apart in round-trip time. You switch to synchronous replication between them. What happens to write latency?

  87. 87.A team has a disaster recovery runbook that has never been run. What should they do?

  88. 88.Users in Asia reach a US-only service with 250 ms round trips, and the app makes 6 sequential calls per screen. What do you change first?

  89. 89.A veterinary records system has one primary database and nightly backups. A restore takes 6 hours, but the goal is under 15 minutes of downtime. What do you add?

  90. 90.A team stores database backups in the same cloud account and region as the database. What is the main risk?

  91. 91.Which is the best service level objective (SLO) for a photo upload API?

  92. 92.A service has a 99.9 percent monthly availability SLO. In a 30-day month, how much downtime does the error budget allow?

  93. 93.A team pages on error rate above 1 percent for one minute, and gets many false alarms. Which alert is better?

  94. 94.Tracing every request at 50,000 requests per second costs too much. What sampling approach keeps the most value?

  95. 95.A payroll export must finish by 6 a.m. each day. What should the main alert check?

  96. 96.In a photo backup service, 80 percent of photos are never opened after 30 days. How do you cut storage cost?

  97. 97.A cloud bill shows high data transfer charges between availability zones, caused by chatty internal service calls. What helps?

  98. 98.A tax filing service sees 20 times its usual traffic in April. How should capacity be planned?

  99. 99.A three-person team needs a job queue for about 200 messages per second. What is a sensible choice?

  100. 100.You are moving a live service from one database to a new one with no downtime. Which order is safest?

  101. 101.During a database migration, shadow reads show 0.3 percent of results differ between the old and new stores. What do you do?

  102. 102.You are splitting an orders table out of a monolith into a new orders service. What is the safest first step?

  103. 103.You are resharding a key-value store from 8 shards to 16 while it serves traffic. What makes the move safe?

  104. 104.Two days after moving writes to a new store, you find a bug that corrupts some records. What would have made rollback safe?

  105. 105.An order event schema is read by six other teams. You need to change the meaning of one field. How do you roll it out?

  106. 106.A wedding photographer's gallery lets clients share albums by link. How should share links work?

  107. 107.A user asks to delete their account, and their data lives in eight services. How should deletion work?

  108. 108.The interviewer asks why you chose Postgres over a wide-column store for a library room booking system. What is the strongest answer?

  109. 109.Which is the best way to present a design tradeoff in an interview?

  110. 110.Partway through, the interviewer asks what happens at 100 times the traffic. What is the best response?