Airbnb System Design: Most frequently asked question in technical interviews.

Airbnb System design explanation by CODEKARLE

SYSTEM DESIGN is one of the last technical round question that you will face in any interview process. In this article, let us discuss the system design of Airbnb.

Airbnb is a online platform which associates individuals who need to rent out their houses through individuals who are looking for lodgings and rooms in a place/city.

First let us understand the functional and the non functional requirements.

Functional requirements:

We have two major consumers of this application. One is the hotel side user and the other is the consumer who wants to book from outside.

Hotel side user:-

1. Onboarding: Hotel side user should be able to onboard to the platform

2. Update: Hotel side user should be able to update the platform

3. Bookings: And also user should be able to see what the bookings are there

Outside User (consumer):-

1. Search: User should be able to search for a property in a particular location.

2. Bookings: User should be able to book the hotel room and check the bookings

3. Analytics

Non-functional requirements:

1.Low latency

2.High availability

3.High consistency

4.Scale

Now let us look at overall design of the system and also how data flows in the system.

OVERALL DESIGN OF THE SYSTEM

UI/APP FOR HOTEL:

User interface is a place where human and computer device gets interaction and communication on a device, or an app. Here user could onboard the chat box and also used to modify the properties . Lets say user wants to add an image of the room, hotel, etc. This user interface helps the user to add and interact.

LOAD BALANCE(LB):

load balancer is in between the client and server for receiving the request of the client and then distributing requests to server which can fulfil the client request.

HOTEL SERVICE:

Here, when the UI talks to load balance through which it talks to the hotel service. And in the hotel service, it manages the onboarding.

1.MYSQL CLUSTER:

MYSQL Cluster is a distributed data-base. In our design we use MYSQL Cluster data to add the image and the data that is sent by the hotel user. For example, if the hotel user wants to add the image then that data of the image will be stored in this MYSQL Cluster.

CDN:

CDN means Content Delivery Network. CDN is an intermediary server between the client and the origin server itself. Here the data to be add by the hotel user like images, etc. will be stored. The URL of the image will be stored in the data base. And when ever the client or the user needs it will be sent to the customer. CDN is a geographically distributed data store which will be using for sending out images throughout the whole world.

EXAMPLE: If the user wants to look at an image of hotel from INDIA and the other user wants to see the image of the same hotel from USA , Indian user will look that image from CDN server which is located in INDIA and the USA user will look from CDN server in USA

This is all about hotel management life-cycle.

KAFKA:

So lets say the hotel user is modifying the properties. So each modification that is happening with hotel service will flows through the KAFKA Cluster. So all the data will be stored in the KAFKA.

SEARCH CONSUMER:

Now the search consumer push ups the data from KAFKA and it stores that in its own data-base.

ELASTIC SEARCH CLUSTER:

The data pushed up from the KAFKA by search consumer will be stored in a data base which is called as elastic search cluster.

SEARCH SERVICE:

This is the service which searches on the website/application. For example, what ever user asks to search like a particular hotel ,here searching takes place.

UI/APP FOR USER SEARCH AND BOOK:

User interface is a place where human and computer device gets interaction and communication on a device, or an app. Here user will search for some properties and that search property will be passed to search service via load balance. Booking requests also comes through the load balance .

This is all about the search flow.

BOOKING SERVICE:

This service accepts request from UI for booking. For example if the user request to books the room that request is sent to the booking service via load balance from UI.

2.MYSQL CLUSTER:

when ever a booking happens ,it stores data in MYSQL CLUSTER. And also data is sent to KAFKA.

ARCHIVAL SERVICE:

Actually till now we have seen that booking requests have been sent but has not been completed. Lets say booking has been cancelled ,then that is sent to the archival service.

CASANDRA CLUSTER:

Then that cancelled data is sent to the CASANDRA cluster. The reason why we are storing in CASANDRA is that it is database which can handle huge about of reads and writes.

NOTIFICATION SERVICE:

Once if the booking is successful, then we have to notify the user that booking is successful, this notification happens in the notification service.

UI/APP TO VIEW BOOKINGS(hotel user as well as the customer):

sometimes hotel user wants to see all the bookings or the customers wants to see his/her particular booking. Then user requests the information from this user interface.

BOOKING MANAGEMENT SERVICE:

Here it takes the request from UI and then search if the booking is places or not with the MYSQL cluster and with CASANDRA that if the booking has cancelled or already placed.

REDIS:

REDIS lowers the load on MYSQL.

This is the functional flow.

NOW LET US SEE THE ANALYTICS,

HADOOP CLUSTER:

For example if a business man wants to know how much revenue we are making, or how many booking they are having….so they need to do lot of analytics. so , HADOOP CLUSTER see all these analytics.

This is all about the design and how the data flows in the system.

NOW LETS LOOK AT WHAT HOTEL SERVICE INTERNALLY IS,

How the booking service works?

  1. Check in available rooms
  2. Insert in booking and then reduce in available rooms.
  3. Put in REDIS
  4. Put in KAFKA
  5. Redirect to payment.

This was clearly explained above.

And this is all about the system design of the Airbnb.

And all this is written based on “CODEKARLE”, system design series channel.

Computer Science Student at SRM University,AP