CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 6 of 6 · 3 min read

Exercises

Easy

Easy 1: CP or AP (20 minutes)

Say whether each behaviour is CP or AP: a bank returns an error while replicas disagree; a chat app shows old messages until the link returns; a lock service refuses to grant locks without a majority; a "likes" counter keeps counting on both sides.

Done when: four labels.

Hint

If it refuses to protect correctness, it is CP.

Easy 2: Spot the myth (20 minutes)

Correct this sentence: "Our database is CA because we chose consistency and availability and did not need partition tolerance."

Done when: a corrected sentence and one reason.

Hint

Partitions cannot be switched off.

Easy 3: Which letter (20 minutes)

In PACELC, which choice applies in each case: replicas cut off; healthy network but cross-continent writes; a node crash with the rest healthy and connected?

Done when: three answers.

Hint

P applies only when the network is split.

Medium

Medium 1: Three-node trace (30 minutes)

Three nodes hold x = 5. n3 is cut off. A client sets x = 8 on n1. Show the states and reads at n1, n2 and n3 under a CP and an AP design. When the link returns, what happens?

Done when: two timelines.

Hint

In CP, the cut-off node or the minority side stops serving.

Medium 2: Latency table (30 minutes)

Replicas are 3 ms, 30 ms and 120 ms away. Compute confirmation times for waiting for all, a majority, and the nearest one (round trip is twice the distance). Say which fits a payment and which a view counter.

Done when: a table with three rows and two choices.

Hint

Majority of 3 means waiting for 2 replies, so the second nearest.

Medium 3: Per-feature plan (30 minutes)

A food delivery app has: place order, restaurant menu, driver location, payment, order status. For each give the model, behaviour in a partition and cost in normal operation.

Done when: a table of five rows.

Hint

Driver location can be old by a few seconds. Payments cannot.

Hard

Hard 1: Critique CAP (45 minutes)

Write a short note on why CAP is of limited use, based on the DDIA arguments, and then on why it is still useful in an interview. Include at least three points for each side.

Done when: a two-sided note with six points.

Hint

Take the arguments from the book and from interview practice separately.

Hard 2: Two regions (45 minutes)

A game keeps player inventory in two regions. Design for a 10-minute link failure. Decide what is allowed in each region, how conflicts are merged, and which actions are blocked. Count what could go wrong.

Done when: a design with allowed and blocked actions, a merge rule and a risk list.

Hint

Inventory totals need rules, such as no spending more than the balance seen locally.

Hard 3: Pick a setting (50 minutes)

A store offers consistency settings: "one replica", "majority" and "all replicas". For three features (profile page, wallet balance, product reviews) choose a setting for reads and for writes. Explain with latency, availability and what happens with one replica down.

Done when: a table of three features by two operations with reasons.

Hint

A majority read plus a majority write overlap in at least one replica.