KatInterview

Architecting a High-Throughput Hotel Reservation Platform

System DesignModel answer
HardModel answerSystem Designdistributed-systemsconcurrencyscalability

Last updated

Design a backend system handling 100k reads/sec and 10k booking attempts/sec with sub-200ms latency, preventing double-bookings under viral traffic spikes.

You're tasked with architecting the backend infrastructure for a hotel reservation platform that must handle extreme traffic patterns. The application serves a massive consumer base where properties can suddenly experience viral popularity, resulting in millions of concurrent users attempting to view and book the same location.

Core Capabilities

Users interact with the system to:

  • Search properties by location, stay dates, and filtering criteria
  • See current room availability and pricing for specific properties
  • Submit reservation requests and receive immediate confirmation or denial

Functional Scope

  • Property search supporting location, date ranges, and attribute filters
  • Real-time display of remaining inventory and current rates for a given property and date span
  • Reservation creation for selected properties, room categories, and date ranges
  • Absolute guarantee: identical room-nights cannot be sold twice
  • Basic cancellation support (high-level approach sufficient)

Performance & Scale Requirements

Concurrency:

  • Peak load: approximately 100,000 availability queries per second
  • Peak load: approximately 10,000 reservation attempts per second

Response Time:

  • 99th percentile latency under 200ms for both availability checks and booking confirmations, measured client-side

Reliability:

  • System must remain operational through individual node failures or complete availability zone outages

Consistency Model:

  • Availability displays may show slightly outdated counts (eventual consistency acceptable)
  • Booking commitments must be strictly correct (strong consistency required, zero double-bookings)

Message Delivery:

  • Live availability updates pushed to clients can tolerate occasional dropped messages
  • Booking requests and confirmations must never be lost

Traffic Distribution:

  • Properties can become extremely popular with highly skewed traffic patterns
  • Architecture must distribute load for viral properties across multiple nodes rather than concentrating on single endpoints

Protocol Considerations:

  • Evaluate trade-offs between HTTP, persistent connections, and lightweight protocols
  • Match protocol choice to reliability requirements and latency targets for each flow

Design Exercise

Your architecture should address:

  1. Protocol selection and message reliability:

    • When should you use persistent connections or lightweight protocols instead of standard HTTP?
    • Which system flows can accept message loss, and which require guaranteed delivery?
  2. Concurrent booking safety:

    • How do you prevent multiple users from successfully reserving the final available room-night?
    • What techniques (throttling, request batching, atomic operations, locking, queuing) apply here?
  3. Load distribution for viral properties:

    • How would you horizontally scale to handle a single extremely popular property?
    • Compare approaches: partitioning by room identifiers versus partitioning by user identifiers

Your solution should include:

  • Major system components and their responsibilities
  • Data models for properties, room categories, inventory tracking, and reservations
  • Complete request flows for availability lookup and booking confirmation
  • Explanations of how your design achieves low latency, prevents double-bookings, and handles traffic hotspots
  • Key trade-offs and rationale for your architectural decisions

You may assume any technology stack (relational/NoSQL databases, caching layers, message queues, etc.).

Hints

Hint 1

Start by identifying which operations require strong consistency versus eventual consistency—this drives your architecture choices.

Hint 2

Consider what happens when 5,000 users try to book 50 remaining rooms simultaneously. The system's primary job for viral properties is fast, cheap rejection.

Hint 3

Think about the unit of inventory: are you tracking individual physical rooms or fungible room-nights by category? This fundamentally changes your concurrency strategy.