Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

A ticketing platform runs on a leaderless store with three replicas per data center in two data centers. It serves seat-map browsing, seat reservation, purchase records and a high-volume view counter.

Choose consistency levels or mechanisms for each operation, explain the latency and availability cost of each choice, and say what you would keep out of this store.

Seat-map browsing reads at LOCAL_ONE or LOCAL_QUORUM, because a slightly stale map is fine when the reservation itself is checked. Seat reservation uses a conditional write such as INSERT ... IF NOT EXISTS with LOCAL_SERIAL, a Paxos round that costs several times a plain write and fails rather than proceeds without a quorum, used only for the contested step and with each event's reservations routed to one home data center. Purchase records use LOCAL_QUORUM and are idempotent by purchase id. The view counter avoids read-modify-write by aggregating increments in a stream. The payment ledger and cross-row invariants stay in a transactional database, linked by ids.

Why this question is asked

A ticketing platform is a good test of tunable consistency because its operations have very different needs: millions of people browse, thousands compete for the same seats, every purchase must be recorded exactly once, and a view counter can be roughly right. Interviewers ask this design question to see whether we pick consistency per operation with a reason and a cost, rather than one level for everything. In this answer, we will recap the consistency levels available with three replicas in each of two data centers, go through the four operations one by one, decide what to keep out of the store, and look at what happens when the data centers are cut off from each other.

1A Quick Recap of the Tools

With three replicas per data center, LOCAL_ONE asks a single local replica, the fastest and least consistent option. LOCAL_QUORUM needs two of the three local replicas, so reads and writes at that level overlap within the data center, and one replica can be down. Neither of them gives atomic check-then-write: two clients can both read seat 14C as free and both write themselves as its holder, and last write wins keeps one of them without an error.

For that, Cassandra offers lightweight transactions: a write with an IF condition, run through Paxos among the replicas. With SERIAL, Paxos uses a quorum of all replicas in all data centers; with LOCAL_SERIAL, only a quorum of the local data center's replicas. In the classic implementation it takes about four round trips, prepare, read, propose and commit, so a conditional write costs several times a plain one; Cassandra 4.1 and later include an improved Paxos that needs fewer, so check your version.

2Choosing Per Operation

Let us go through the operations in order of volume.

Consistency per operation
OperationMechanismLatency and availability cost
Seat-map browsingLOCAL_ONE or LOCAL_QUORUM reads, short cachelowest; stale map is fine, reservation checks
Seat reservationIF NOT EXISTS / IF holder = null, LOCAL_SERIALseveral round trips; fails without local quorum
Purchase recordsLOCAL_QUORUM, keyed by purchase idone local round trip; survives one replica down
View counterstream aggregation, periodic plain writesno per-view write; totals seconds behind
Payment ledgertransactional database, not this storekept outside; linked by purchase id

Seat-map browsing is by far the largest load and can tolerate staleness, because the map is only a hint: if a seat shows as free but was just taken, the reservation step will say so. LOCAL_ONE gives the lowest latency; LOCAL_QUORUM costs a little more but avoids showing a seat as free long after it was sold if one replica is lagging. Either way, a cache in front with a few seconds of time to live is reasonable.

Seat reservation is the contested step and the only one that needs consensus. Each seat is a row, and a reservation is a conditional write that succeeds only if nobody holds the seat. It is slow and fails when a quorum is unreachable, which is exactly right: refusing a reservation is far better than selling a seat twice.

Purchase records are written once per purchase and read by the customer and by support. LOCAL_QUORUM for writes and reads gives read-your-writes within the data center and tolerates one failed replica. The write is keyed by a purchase id generated by the client, so a retry after a timeout writes the same row again instead of creating a second purchase.

The view counter is high-volume and approximate. A read-modify-write of a number would lose increments under concurrency, and Cassandra counter columns avoid that but are not idempotent, so a retried increment counts twice. The better design sends view events to a stream such as Kafka, aggregates them per event and minute, and writes the totals periodically with a plain write.

3The Reservation Step in Detail

Here is the conditional write. It creates the seat's row only if nobody has created it yet, so the first buyer wins and every later buyer is told at once. When seats are pre-created with an empty holder, the same idea is written as UPDATE seats SET holder = ? WHERE event_id = ? AND seat = ? IF holder = null.

SQL
-- seats(event_id, seat, holder, held_until), PRIMARY KEY ((event_id), seat)
INSERT INTO seats (event_id, seat, holder, held_until)
VALUES (881, '14C', 'cart-7f3a', '2026-11-13 19:05:00')
IF NOT EXISTS;
-- [applied] = True : reserved for cart-7f3a
-- a second buyer, a moment later
INSERT INTO seats (event_id, seat, holder, held_until)
VALUES (881, '14C', 'cart-91bd', '2026-11-13 19:05:10')
IF NOT EXISTS;
-- [applied] = False | holder = cart-7f3a : already taken, tell the buyer at once
-- releasing an expired hold safely
DELETE FROM seats WHERE event_id = 881 AND seat = '14C' IF holder = 'cart-7f3a';

Notice that the row also carries held_until, so an abandoned cart's seat can be released by a background job, with a conditional delete that only removes the hold if it still belongs to that cart. Because all seats of an event share the partition key event_id, a buyer reserving several seats can use a conditional batch within that one partition, which keeps multi-seat reservations atomic.

4What Stays Out of This Store

Anything that needs transactions across partitions or tables does not belong here. The payment ledger is the clearest case: it must record each charge and refund exactly once, balance to the cent and support audits, which is the home ground of a transactional database such as PostgreSQL. Cross-row invariants such as one order may hold at most eight seats across several events, or a seat must be linked to exactly one paid order, also span partitions, unless they can be expressed inside one partition.

So the ledger and order records live in the transactional database, and the two stores are linked by ids: the reservation row carries the cart id, the purchase record carries the purchase id, and the payment ledger references both. A reconciliation job compares paid orders with held seats and releases or flags any mismatch.

5When the Two Data Centers Are Cut Off

LOCAL_SERIAL runs Paxos only among the local data center's replicas. That is why it is fast, and also why it is safe only if every reservation for a given seat goes through the same data center. If buyers in both data centers can reserve seat 14C with LOCAL_SERIAL, each data center can grant it independently, and during a partition between them, both will. So we give each event a home data center and route all its reservations there; the other data center serves browsing from its replicas and forwards reservation requests.

During a partition, that means buyers who reach the event's home data center keep reserving normally, while buyers in the other data center cannot reserve until the link returns, or are redirected at the edge. The alternative, SERIAL across both data centers, would need four of six replicas, so neither side could reserve during the partition at all. Browsing and purchase-record reads continue in both data centers, perhaps a little stale.

6Follow-up questions

What happens to reservations during a partition between the two data centers?

With a home data center per event and LOCAL_SERIAL, reservations continue in the event's home data center and are unavailable from the other side, which is safe. If both data centers were allowed to reserve the same seats with LOCAL_SERIAL, both could grant the same seat. With SERIAL, no side has the four of six replicas needed, so reservations stop everywhere until the link returns.

Why not use LOCAL_SERIAL for purchases too?

Purchases do not compete for anything: each has its own id. Paxos would add several round trips and reduce availability without preventing any conflict. Idempotent writes at LOCAL_QUORUM are enough.

Can lightweight transactions handle a very hot event?

Paxos on one seat row serialises competing buyers for that seat, which is what we want, but very hot events produce many failed attempts. An admission queue in front, letting buyers in at a controlled rate, keeps Paxos contention and timeouts low.

7Conclusion

In this answer, we chose consistency per operation. Browsing reads at LOCAL_ONE or LOCAL_QUORUM because the reservation does the real check. Reservations use a conditional write with LOCAL_SERIAL, which costs several round trips and fails without a quorum, and each event's reservations go to one home data center so LOCAL_SERIAL stays safe. Purchases use idempotent LOCAL_QUORUM writes, and view counts come from stream aggregation. The payment ledger and cross-row invariants live in a transactional database linked by ids.

What to say in the interviewAbout 100 seconds aloud

Open with

I would choose per operation. Seat-map browsing is the bulk of traffic and only a hint, so I read at LOCAL_ONE, or LOCAL_QUORUM if lagging replicas show sold seats as free for too long, with a short cache in front.

Then, if they want more

A stale map is fine because the reservation itself is checked. The reservation is the one contested step, so it is a lightweight transaction: INSERT IF NOT EXISTS on the seat row, or UPDATE IF holder is null, with LOCAL_SERIAL.

That runs Paxos, roughly four round trips in the classic implementation, so several times a normal write, and it fails rather than proceeds without a local quorum, which is the right behaviour.

Because LOCAL_SERIAL only coordinates within one data center, I give each event a home data center and route its reservations there; otherwise both data centers could sell the same seat. Holds carry an expiry and are released with a conditional delete.

Purchase records are written and read at LOCAL_QUORUM and keyed by a client-generated purchase id, so retries are idempotent and one replica down does not block. The view counter should avoid read-modify-write; counter columns are not idempotent, so I would aggregate view events in a stream and write totals periodically.

Finally, I keep the payment ledger and invariants that span partitions or tables in a transactional database like PostgreSQL, and link it to this store by cart and purchase ids, with a reconciliation job between them.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Choose consistency levels or mechanisms for each operation, explain the latency and...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/6b617b72e8/