Design Hotel Booking System
Possible Features of System
There are users searching for hotels
There are hotels listing availability and other details
User search for hotels based on locations, dates, pricing, offerings etc.
Room availability needs to be updated (real time or eventual consistency)
Payment Collections
Booking cancellation
Other offerings like flight, conveyance from hotel to airport etc.
Clarifications:
Do we want to assign rooms upfront while booking and allot room number or do it during check-in?
Narrowing Down the Problem Statement
We will just list down hotels to users based on search criteria
We will not handle payment and other things for now
Understanding the Scale
Total number of users on the site?
Expected Number of users searching for hotel per day
Number of hotels listed on the site?
Each hotel on an average uploading 50 images, with each image of size 10 MB
Designing the System
Keeping 2 separate systems for hotels and users
User information and hotel metadata in SQL database eg. in PostgreSQL, and cloud storage to store hotel specific images and videos
Caching needs to be handled carefully as hotels will keep on getting booked and hence need to be updated accordingly in database and caching layer.
Caching needs to be handled via redis or something instead of CDN as data consistency is important
CDN for serving the data from the nearest stored data location
Distributed data with replication
Handling concurrency is a major task
When someone making a reservation, lock the rooms from booking for some period of time (similar to what paytm does when booking a bus)
cancellation, payment failed, other status to be maintained via a queue like kafka or rabbitmq or pulsar; a consumer keep on listening and update the inventory
Data Model
User data model would be standard
Hotel data model outline is described below
hotel id
hotel id
hotel id
hotel address
room type
room type
hotel phone
date
start date
hotel image/video urls
available rooms count
end date
total rooms count
count of rooms
room type image urls
payment status
room type charges
Architecture Diagram
Resources
Last updated
Was this helpful?