KatInterview

Reservation Platform and High-Throughput Event Aggregation

System DesignModel answer
MediumModel answerSystem Designconcurrencydistributed-systemsstreaming

Last updated

Build a seat reservation backend with strict consistency and a live vote counter handling millions of writes per second with eventual consistency.

Design two systems that handle different consistency and throughput requirements.

Problem 1: Seat Reservation Backend

Build a backend service for reserving seats on scheduled transportation. Users search available trips, view seating options, reserve specific seats, complete payment, and receive confirmation. The system must guarantee that no seat is sold twice, even under concurrent load.

Address these aspects:

  • Schema design for core entities: scheduled trips, available seats, customer records, and confirmed reservations
  • Database indexing strategy and rationale for each index
  • Internal mechanics of tree-based indexes and how they influence query patterns
  • Complete reservation workflow from search to confirmation, including the SQL operations at each step
  • Concurrency control mechanisms to prevent duplicate seat assignments when multiple users attempt simultaneous bookings

Problem 2: Live Event Vote Aggregation

Design a system for a promotional campaign where users vote in real time during a major broadcast event. The system displays live results updated continuously as votes arrive.

Requirements:

  • Handle burst traffic reaching several million votes per second during peak moments
  • Voting requests should respond quickly to users
  • Results dashboard reflects vote counts with minimal delay (1–2 second lag acceptable)
  • System remains operational despite sudden traffic surges

Cover these elements:

  • Service boundaries, API contracts, storage layers, and data pipeline
  • Role of a distributed log or message queue for durability and buffering
  • Approach to maintaining fast-updating counters and temporal aggregates
  • Relevant internals of the streaming platform and time-series storage
  • Container orchestration deployment including auto-scaling configuration

Hints

Hint 1

For reservations: think about what happens when two users click 'book' on the same seat at the same millisecond—your database operation must be atomic

Hint 2

For voting: recognize that writes vastly outnumber reads, and exact counts can lag by a second—this changes everything about your architecture

Hint 3

B-tree indexes are sorted; multi-column indexes only work left-to-right, so column order in a composite index directly determines which queries it can accelerate