KatInterview

Design a Real-Time Event Venue Booking Platform Architecture

System DesignModel answer
MediumModel answerSystem Designsystem-designconcurrencydatabase-design

Last updated

Design a high-level architecture for an event venue reservation platform, focusing on double-booking prevention, concurrency control, and interval-based storage.

Scenario

Design a venue reservation platform (similar to Peerspace or event space booking engines) where hosts publish spaces (conference halls, banquet rooms, shooting studios) and renters reserve them for specific dates or hourly timeslots.

Key Requirements

Functional Scope

  1. Venue Management: Hosts can manage listings, define standard business hours, set daily/hourly base prices, and configure blackout periods.
  2. Venue Discovery: Renters can query and filter spaces using parameters such as geographical proximity, guest capacity, hourly rate, time window, and required features/amenities.
  3. Reservation & Concurrency Prevention: Renters can lock an available slot temporarily (e.g., a 10-minute hold) to complete payment. Once paid, the booking is finalized. Double-booking any venue for overlapping times must be impossible.
  4. Lifecycle Operations: Manage status transitions across the reservation pipeline: HELD, CONFIRMED, CANCELLED, and EXPIRED.

Operational Expectations

  1. Consistency Guarantees: Strict serializability / strong consistency for reservation states to ensure zero double-bookings. Searching and browsing can accept eventual consistency.
  2. Availability & Performance: Browsing endpoints must handle heavy traffic resiliently.
  3. SLA Limits: Search API latency must stay under 200ms (p95); creation of a temporary hold must respond within 500ms (p95).

System Scale

  • Scale: 5,000,000 active venue listings globally.
  • Traffic: 30 million daily active users (DAU); 50 million search requests per day (~600 QPS average, 3,000 QPS peak).
  • Reservations: 500,000 temporary holds/bookings attempted daily (~6/sec average, 100/sec peak).
  • Read-to-Write Ratio: Heavily read-skewed (~100:1 read/write balance).

Focus Areas

  1. API Endpoints: Interfaces for searching venues, acquiring temporary holds, and finalizing payments.
  2. Data Storage & Range Modeling: Schema strategy for listings vs. schedule windows (e.g., comparing discrete time slots vs. continuous time ranges).
  3. Architecture Overview: Complete topology encompassing search engines, core transactional services, caching strategy, and asynchronous queues.
  4. Race Conditions & Concurrency: Mechanisms for guaranteeing mutual exclusion when multiple users target the exact same venue and time window simultaneously.

Hints

Hint 1

Separate the search read path (eventually consistent) from the reservation write path (strongly consistent).

Hint 2

Consider PostgreSQL PostgreSQL range types (`TSTZRANGE`) and `EXCLUDE` constraints to enforce non-overlapping time windows directly at the storage level.

Hint 3

Implement temporary holds using short-lived database rows combined with lazily evaluated expiration logic to avoid relying solely on external distributed locks.