Sanjaay Gowda T S
All practice questions

ORIGINAL TECHNICAL PRACTICE

Choose consistency from an invariant

System designHardConcept

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

  1. List invariants and user-visible guarantees, such as read-your-writes after a profile edit or preventing overselling during reservation.
  2. Define which store is authoritative and which views are derived. Route invariant-changing operations through a protocol that can enforce the required rule.
  3. 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.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub