Get Your CertSystem Design & Architecture Interview QuestionsPlayCompete
‹ All System Design & Architecture Interview Questions questions

System Design & Architecture Interview Question 1: Cap Partition Inventory

System Design & Architecture Interview Questions · Test 1 · question 1 of 10

CAP & Consistency Modelsmedium

A concert-ticketing service stores seat inventory in a database replicated across three sites. The business rule is absolute: a seat must never be sold to two people, and the business accepts that some customers will see booking errors if needed to guarantee that.

During a network partition, one site loses connectivity to the other two, but clients can still reach every site. How should the system behave while the partition lasts?

Select one answer
Show answer and explanation

Answer:

  • B. Keep accepting bookings only on the side that holds a majority of replicas, and have the isolated site reject booking writes until the partition heals

The CAP theorem says that when a network partition happens, a replicated system must choose between consistency (every read sees the latest write, even if requests have to block or fail) and availability (every non-failing node answers). "Never double-sell, even at the cost of errors" is an explicit choice of consistency over availability (CP). The usual way to get that is a majority quorum. The two connected sites form a majority and can keep committing, because any two majorities share at least one replica. The isolated site cannot tell whether the majority has already sold a seat, so it must refuse writes. That makes it unavailable, but it stays correct.

Option A is the availability-first (AP) choice. Both sides can sell the same seat during the partition, and "reconcile afterwards" means one customer's confirmed ticket gets cancelled. The stem forbids exactly that.

Option C makes things worse. With asynchronous replication, each site acknowledges a booking before the others know about it, so two sites can commit the same seat. It gives up consistency for latency, which is the opposite of the requirement.

Option D serves writes from stale state. The isolated site's copy of the inventory does not include sales the majority made after the partition began, so it will double-sell.

Reference: Relational vs. NoSQL data - CAP and PACELC theorems

Practice Test 1 ›

Study guides for System Design & Architecture Interview Questions