advanced 2 min answer Multiple choice

For a shopping cart at very large scale, would you choose a strongly consistent store or an always-writeable one with conflict resolution?

amazondynamoavailabilitytradeoffs
Pick one
Show the full answer Hide the answer

What the interviewer is testing

Whether you choose a consistency model from the cost asymmetry of the two failure modes rather than from a general preference for correctness.

The reasoning

Ask what each failure costs.

A rejected write: the customer cannot add an item. That is an immediately lost sale, it happens at the moment of highest purchase intent, and it is measurable in revenue.

A conflicting write: two devices or two sessions modify the cart concurrently and the versions diverge. Resolved as a union, the worst outcome is that a removed item reappears — an annoyance the customer corrects in one click.

The asymmetry is decisive: one is unrecoverable revenue, the other is a minor irritation. So the system should never reject a write.

This is the reasoning in Amazon's Dynamo paper, and it is why the resulting design surfaces divergent versions to the application rather than resolving them internally — the correct merge for a cart is a union, and only the application knows that.

The mechanisms this implies

Consistent hashing with virtual nodes for partitioning. Sloppy quorum with hinted handoff, so a write succeeds even when the intended replicas are unreachable. Vector clocks so genuine concurrent writes are distinguishable from stale ones. Anti-entropy to converge replicas.

Where the answer inverts

The same reasoning applied to checkout gives the opposite result. Committing an order against limited inventory has a global invariant, and accepting two conflicting writes means overselling — which is not recoverable in one click. That step should be strongly consistent even in a system whose cart is not.

What a strong answer adds

Noticing that the third option is a trap: a cache in front of a strongly consistent store does not make writes available, because a write still has to reach the store. It improves read latency and addresses none of the stated problem.

And that if you choose availability, the merge semantics must be decided deliberately — because if you do not, the framework has chosen last-write-wins on your behalf, which silently discards data.

Common weak answers

Choosing strong consistency because carts are important. Choosing availability without specifying the merge.