Design a hotel booking site listing 100,000 hotels with about 5 million rooms. Travellers search by city, dates, guests and price, compare results and book a room type for a date range. Searches outnumber bookings about 500 to 1: at peak the site serves 5,000 requests per second but only 10 bookings per second. Hotels also update prices and room counts through an extranet. Two travellers must never get the last room for the same night.
Functional requirements
Search available hotels by city, dates, number of guests and price range
Show a hotel's room types with nightly prices for the chosen dates
Book a room type for a date range, with a confirmation number
Cancel a booking and return the room to inventory
Hotels update prices and room counts through an extranet
Non-functional requirements
No room type is ever booked beyond its inventory on any night
Search results in under 300 ms at p95; availability may be a few seconds stale
The booking path stays available during search traffic spikes
Constraints and scale
100,000 hotels, 5 million rooms, bookings open up to one year ahead
Peak of 5,000 requests per second, about 99% of them searches and hotel pages
About 10 bookings per second at peak
You will practise
Model inventory per room type per night so availability checks are simple
Prevent double booking with transactions and conditional updates
Separate a read-optimised search path from the strongly consistent booking path
Show 2 hints
Is it easier to check availability against individual rooms, or against a count per room type per night?
Search can tolerate stale data; booking cannot. How does that change where each reads from?