FreeExam
A closed notebook, a blank card, and a pencil on a wooden desk.

Backend system design

50 cards

Services and data stores that scale, stay consistent, and fail in a way you chose.

Card 1 of 50

Front. Littles. What does Little's law say?

These cards are original study material. They are not questions from a named employer or a live hiring loop.

All 50 cards in this deck

  1. 1.Littles

    What does Little's law say?

    Average number in the system equals arrival rate times time in the system. Concurrency is QPS times latency, not QPS alone.

  2. 2.Search-index

    When do you add a search index beside the database?

    When users need typos, synonyms, or ranking across text. The database stays the source of truth. The index is a copy built for search.

  3. 3.Stale-ok

    What is stale-while-revalidate?

    Serve the cached value past its freshness time, and refresh it in the background, so a slow origin does not stall the user.

  4. 4.Webhook

    How do you deliver webhooks to a down endpoint?

    Retry with backoff, stop after a limit, and keep the event for the customer to pull. A single attempt drops the event.

  5. 5.Saga

    What is a saga?

    A business action split across services, each with a forward step and a compensating step if a later service fails.

  6. 6.Compensate

    What is a compensating action?

    The undo for a step that already committed, used when a later step in a saga fails and you cannot roll the first one back.

  7. 7.Limiter-down

    What if the rate limiter's store is down?

    Decide in advance: fail open and risk a flood, or fail closed and reject traffic. The middle, 'hang,' piles up requests.

  8. 8.Residency

    What is data residency?

    A rule that some rows must stay in a region. The partition key and the backups have to obey it, not only the app servers.

  9. 9.Cross-az

    Why do cross-zone calls show up on the bill?

    Traffic between zones is metered, and it is slower. Chatty internal calls multiply that cost on every request.

  10. 10.Tradeoff

    How do you state a design tradeoff?

    Name the two options, the constraint that decides it, and what you give up. A diagram with no rejected option is incomplete.

  11. 11.Outbox

    What does an outbox worker do?

    It reads events committed with the row and publishes them. If publishing fails, it retries the same event, so consumers must be idempotent.

  12. 12.Inbox

    What is an inbox table?

    The consumer stores the event id it has handled. A redelivery finds the id and skips the work.

  13. 13.Singleflight

    What is single-flight?

    If many requests miss the same key, only one of them loads it. The others wait for that result.

  14. 14.Hedge

    What is a hedged request?

    A second copy of a slow call is sent a bit later, and you take the first answer. It cuts tail latency and adds load.

  15. 15.Tail

    What is tail latency?

    The slow end of the distribution, often the p99. A user on that tail waits far longer than the average suggests.

  16. 16.Shed

    What is load shedding?

    Refusing some requests on purpose once you are past capacity, so the requests you keep still finish.

  17. 17.Bulkhead

    What is a bulkhead?

    A separate pool of connections or workers for one dependency, so its slowness cannot use up the pool everyone else needs.

  18. 18.Graceful

    What is a graceful shutdown?

    The instance stops taking new work, finishes what it has, and only then exits. A hard kill drops those requests.

  19. 19.Lsm

    What is an LSM-tree store good at?

    High write rates. Writes land in memory and flush to sorted files. Reads may check several files, so compaction matters.

  20. 20.Btree

    What is a B-tree index good at?

    Point reads and short ranges with predictable cost. Each write updates the tree in place.

  21. 21.Hot-key

    How do you cool a hot key?

    Split it, cache it, or change the access so one key is not on every request. More shards do nothing if they all hash to that key.

  22. 22.Partition-key

    What makes a good partition key?

    It spreads writes and matches the query. A key you never look up, or one that clumps, puts the pain on one partition.

  23. 23.Rebalance

    What happens when a shard splits?

    A range of keys moves to a new shard. During the move, both sides have to agree who serves each key.

  24. 24.Leader-election

    What is leader election?

    Nodes agree on one writer. If it fails, the others choose a new one. Two leaders at once means split writes.

  25. 25.Lock-service

    What is a distributed lock for?

    One owner at a time for a job that must not run twice. The lock needs a timeout, or a dead owner holds it forever.

  26. 26.Fence

    What is a fencing token?

    A number that increases each time the lock is granted. The store rejects writes from an old owner who still thinks it holds the lock.

  27. 27.Cache-invalid

    What is the hard part of cache invalidation?

    Knowing which cached entries a write affects, and deleting them before a reader can observe the stale copy for too long.

  28. 28.Multi-region

    What does active-active mean?

    More than one region accepts writes. You need a rule for two regions changing the same row.

  29. 29.Conflict

    What is a conflict resolution rule?

    How to merge or pick a winner when two writes race. Last-write-wins is a rule. It can drop a real update.

  30. 30.Queue-lag

    What is consumer lag?

    How far the consumer is behind the latest message. Growing lag means the consumers are slower than the producers.

  31. 31.Poison

    What is a poison message?

    A message that fails every time it is processed. Without a limit, it blocks the partition behind it.

  32. 32.Dlq

    What is a dead-letter queue?

    Where a message goes after its retries are used up, so a person can look at it and the main queue can move on.

  33. 33.Ordering

    When does a queue preserve order?

    Usually inside one partition or key. Across partitions, messages are not in send order.

  34. 34.At-least

    What does at-least-once delivery mean?

    The message will arrive, and it may arrive more than once. The consumer has to tolerate the duplicate.

  35. 35.Exactly

    Why is exactly-once easy to overclaim?

    A redelivery can still happen. What you can build is an effect that happens once, by storing the id of work already done.

  36. 36.Connection

    Why limit connections from each instance?

    A fleet that grows can open more connections than the database allows. The pool size times the instance count is the real number.

  37. 37.Zero-down

    What does a zero-downtime deploy require?

    Old and new code run together, the data shape works for both, and traffic moves only to copies that are ready.

  38. 38.Config

    Why keep config out of the image?

    So a timeout or a feature can change without a rebuild. A secret in the image is also a secret in every registry copy.

  39. 39.Coalesce

    What is request coalescing?

    Joining identical in-flight lookups into one. It is how you stop a burst of the same key from becoming a burst of database reads.

  40. 40.Write-amp

    What is write amplification?

    One logical write becoming several physical writes, from indexes, replicas, or compaction. It caps how fast the store can ingest.

  41. 41.Read-repair

    What is read repair?

    A read that notices a replica is behind and updates it. It heals copies that reads actually touch, and ignores the rest.

  42. 42.Quorum-read

    Why read from more than one replica?

    So a value that only one stale copy holds is not the one you return. You compare, or you require a quorum.

  43. 43.Hinted

    What is a hinted handoff?

    A write saved on a stand-in node while the owner is down, then delivered when the owner returns.

  44. 44.Backpressure

    How does a service apply backpressure?

    It slows or refuses new work when its queue or its dependency is full, instead of accepting work it cannot finish.

  45. 45.Timeout-chain

    What happens if only the edge has a timeout?

    An inner call can outlive the user request and keep working. Every hop needs its own deadline.

  46. 46.Idem-store

    Where do you store an idempotency result?

    Somewhere that survives the process, keyed by the client token, with a lifetime long enough to cover the client's retries.

  47. 47.Schema-owner

    Who should own a shared table's schema?

    The team that can change it and tell every caller. A table anyone alters has no one to ask before a breaking change.

  48. 48.Cell

    What is a cell in a backend design?

    A slice of the system that serves a fixed set of users and fails on its own. A bug then takes one cell, not the whole product.

  49. 49.Capacity

    What is headroom?

    The spare capacity above today's peak. Without it, the next traffic spike is the outage.

  50. 50.Observability

    What do you add so a design can be run?

    A latency and error measure per hop, a trace id that crosses services, and a log line carrying that id. On call, those are what you open when a request is slow or failing.