How do hotel booking apps like Airbnb, Booking.com, and OYO provide a smooth flow from hotel listing to booking to payment? And all without a glitch! In this blog, you will get a detailed explanation of it.
Since they are so large, they need to handle a lot of user traffic. So to manage these we have to follow microservices architecture. This means we have to break the system into small pieces for each type of task.
Let's understand the process one by one. I have divided it into 4 parts:
-
Hotel Management Services
-
Customer Service (Search + Reservation)
-
View Reservation Services
Hotel Management Services
This is the service that will be provided to the hotel manager/owner. Here managers can manage information about their hotel. Here, managers have a single portal to access and update data.
-
Hotel Management Service Architecture
Whenever the API is triggered from the hotel manager application, the initial request is sent to the load balancer, which then distributes the request to the desired server for processing. The Hotel Services cluster has multiple servers that have containers for Hotel Services related APIs.
Now, the hotel service interacts with the hotel database cluster following the master-slave architecture to reduce the load on the database. Basically, in this approach, we create a copy of the master database, called a slave. Master DB is used for write operations and slave DB is used for read operations only. Whenever a write operation is performed on the master database, it will synchronize the data to the slave database.
Whenever any data in the database is updated, the API will send the data to CDN (Content Distributed Network) and message queuing system (such as Kafka, RabbitMQ) for further processing. A CDN is a group of geographically distributed servers that work together to provide fast delivery of Internet content.
Customer Service (Search + Reservation)
This is the service that will be provided to the customer. Here customers can search and book hotels. Here, customers have a single portal to access and process data.
-
Customer Service Architecture
The CDN application displays content to customers such as nearby hotels, recommendations, deals, etc.
As we discussed in the previous section, hotel data is sent in a message queuing system for processing. Here we have a message queue consumer which fetches data from the queue and stores the data in elastic search.
The client application hits the API, and the load balancer redirects and distributes the request to the appropriate service to handle the request. Here we have two services, one is searching for hotels and the other is booking service which is used to book hotels and the booking service also interacts with the payment service of the third party service.
The search service must fetch data from Elastic Search. Elasticsearch is a NoSQL database best suited for its search engine capabilities.
The subscription service communicates with Redis and the subscription database cluster. Redis is a caching system that stores temporary data, so the data doesn't need to be fetched from the database, which ultimately reduces the load on the database and also reduces the response time of the API.
Any changes made to the database will be sent to the messaging queue. The consumer will then take the data from the queue and put it into Casandra. For archiving we use Casandra because over time the data size in the database grows and this increases query times. That's why we may need to delete old data from the database. And Casandra is a NoSQL database, good at handling large amounts of data.
View Reservation Services
All current and old booking details are displayed to the user here. Both managers and clients use this service.
-
View Booking Architecture
The Customer/Manager application sends the request to the load balancer, which distributes the request to the subscription management servers. Then service requests for the data through Redis and Cassandra. With Redis, it requests the most recent data since it is a caching server. This reduces load times on the application side.
final design
-
Hotel Booking System Design
As you can see in the design above, there is a Kafka consumer for notifications, and the notification consumer sends notifications. This could be for a client/manager, e.g. whenever a client books a hotel, a notification is sent to the manager, or if a new offer is coming, the client is notified.
Apache Streaming service fetches data from message queue and stores it in Hadoop, which can be used for big data analysis for various purposes. Such as business analysis, finding potential customers, audience classification, etc.
This article: https://architect.pub/system-design-architecture-hotel-booking-apps-airbnb-oyo | ||
Discussion: Knowledge Planet [Chief Architect Circle] or add WeChat trumpet [ca_cto] or add QQ group [792862318] | ||
No public |
【jiagoushipro】 【Super Architect】 Brilliant graphic and detailed explanation of architecture methodology, architecture practice, technical principles, and technical trends. We are waiting for you, please scan and pay attention. |
|
WeChat trumpet |
[ca_cea] Community of 50,000 people, discussing: enterprise architecture, cloud computing, big data, data science, Internet of Things, artificial intelligence, security, full-stack development, DevOps, digitalization. |
|
QQ group |
[285069459] In-depth exchange of enterprise architecture, business architecture, application architecture, data architecture, technical architecture, integration architecture, security architecture. And various emerging technologies such as big data, cloud computing, Internet of Things, artificial intelligence, etc. Join the QQ group to share valuable reports and dry goods. |
|
video number | [Super Architect] Quickly understand the basic concepts, models, methods, and experiences related to architecture in 1 minute. 1 minute a day, the structure is familiar. |
|
knowledge planet | [Chief Architect Circle] Ask big names, get in touch with them, or get private information sharing. | |
Himalayas | [Super Architect] Learn about the latest black technology information and architecture experience on the road or in the car. | [Intelligent moments, Mr. Architecture will talk to you about black technology] |
knowledge planet | Meet more friends, workplace and technical chat. | Knowledge Planet【Workplace and Technology】 |
Harry | https://www.linkedin.com/in/architect-harry/ | |
LinkedIn group | LinkedIn Architecture Group | https://www.linkedin.com/groups/14209750/ |
Weibo | 【Super Architect】 | smart moment |
Bilibili | 【Super Architect】 | |
Tik Tok | 【cea_cio】Super Architect | |
quick worker | 【cea_cio_cto】Super Architect | |
little red book | [cea_csa_cto] Super Architect | |
website | CIO (Chief Information Officer) | https://cio.ceo |
website | CIOs, CTOs and CDOs | https://cioctocdo.com |
website | Architect practical sharing | https://architect.pub |
website | Programmer cloud development sharing | https://pgmr.cloud |
website | Chief Architect Community | https://jiagoushi.pro |
website | Application development and development platform | https://apaas.dev |
website | Development Information Network | https://xinxi.dev |
website | super architect | https://jiagou.dev |
website | Enterprise technical training | https://peixun.dev |
website | Programmer's Book | https://pgmr.pub |
website | developer chat | https://blog.developer.chat |
website | CPO Collection | https://cpo.work |
website | chief security officer | https://cso.pub |
website | CIO cool | https://cio.cool |
website | CDO information | https://cdo.fyi |
website | CXO information | https://cxo.pub |
Thank you for your attention, forwarding, likes and watching.