CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 5 of 6 · 2 min read

Using the ideas in a design

Decide per feature, state the user-visible behaviour, and name what you give up.

Using the ideas in a design

Think of an airline. Seat selection must never double-book, so it can refuse during trouble. The "flights near you" list can be a little old without harm. One airline, two different promises.

A good design does not label the whole system CP or AP. It lists the features and, for each, says what the user sees when replicas cannot talk, and what it costs when they can.

A worked example, a ticket shop (made up to show the idea).

Feature During a partition Normal day Model (module 6)
Buy a ticket Refuse if the seat count cannot be confirmed by a majority A write waits for a majority, tens of ms Linearizable on the seat count
Show tickets left Show last known count, mark "approximately" Served from the nearest replica Eventual
Order history Show what this region knows Local read Read your own writes at least
Admin report Delay until the partition heals Run from a snapshot Snapshot (module 2)

Why this works: only the part with a hard rule (never oversell) pays for strong consistency. The rest stays fast and available.

Steps for an interview answer:

  1. List the data items and their rules ("never negative", "may be a minute old").
  2. For each rule, pick a model from the ladder (module 6).
  3. Say what happens in a partition for each, in the user's words.
  4. Say what the strong parts cost on a normal day (latency) and how you limit it, for instance with a majority instead of all replicas.
  5. Say how recovery works when the link returns (merge, replay or catch-up).

Check yourself:

  • Why not label the whole shop CP?
  • What does the design do on a normal day for the seat count, and what does it cost?

Words you will meet

Word Plain meaning
CAP theorem During a partition, choose consistency or availability
Consistency (in CAP) Every read sees the latest write, like one copy
Availability (in CAP) Every request to a working node gets a response
Network partition A network fault that splits nodes into groups that cannot talk
CP system Keeps consistency and may refuse requests during a partition
AP system Keeps answering during a partition and may be stale
PACELC CAP plus: else, choose latency or consistency
Latency How long one operation takes
Tunable consistency A setting that moves a store along the consistency and speed trade-off
Stale read A read that returns an older value