ORIGINAL TECHNICAL PRACTICE
Choose consistency from an invariant
A system shows user profiles, available inventory and a running analytics count. Must they all use the same consistency model?
Written for independent practice. The model answer presents one approach; clarify constraints and explain alternatives.
A REASONED APPROACH
Model answer.
No. Identify the consequence of stale or conflicting data for each operation. Profile display and analytics may tolerate delay, while an inventory reservation can require a stricter atomic decision.
Work through it
- List invariants and user-visible guarantees, such as read-your-writes after a profile edit or preventing overselling during reservation.
- Define which store is authoritative and which views are derived. Route invariant-changing operations through a protocol that can enforce the required rule.
- Describe behavior during partitions and dependency failure, including whether an operation fails, queues, or returns a stale value. Test reconciliation after recovery.
Tradeoffs to discuss
- Stronger coordination can increase latency and reduce availability during failures. Eventual consistency can improve responsiveness but requires a clear stale-data and conflict policy.
Common pitfalls
- A replicated read followed by an independent write may not enforce an invariant. Using the word consistent without stating which guarantee is required leaves the design underspecified.