This is amazing. Over an hours worth of concise and cohesive information with no fluff. This may be one of the best video systems designs I have seen.
@CSKnowledge007Ай бұрын
I liked the CDN, elasticsearch, kafka part. That was something new, unlike regular HLD videos where people just draw some server, DB, loadbalancer etc. Planning of microservices and DB can be done easily once fundamentals are clear. But knowing what tech service to use is the important part.
@yashnasery85012 ай бұрын
The inventory table for me needs a little bit of explanation. In the booking flow described around 01:06:50, it is said that we check if rooms are available in inventory for all the dates between check-in and check-out. There are a few things left unexplained here (Apologies if I missed it somehow and it was explained.) 1) The inventory table has inventory on dates. For example (Correct me if this example is wrong) hotel_id = 10, room_type_id = 1, date = 16th May, available_rooms = 4, total_rooms = 10 hotel_id = 10, room_type_id = 1, date = 17th May, available_rooms = 4, total_rooms = 10 hotel_id = 10, room_type_id = 1, date = 18th May, available_rooms = 4, total_rooms = 10 Questions: 1) who creates these entries for particular dates? ( I know who decrements them - the person trying to do a booking ) 2) what if I want to book hotel_id = 10 and room_type_id = 1 for dates 17th May - 20th May? (there is no entry for 20th may yet - so do I create it myself?) 3) if in the question 2 above, i do create it myself, there's the issue of the locking mechanism shown to prevent concurrency issues here. can't take a lock on something not created in the first place. maybe I lock 17th May and 18th May and create 19th and 20th May ? 4) what if i do that and someone else also wants a booking for hotel_id = 10 and room_type_id = 1 for dates 17th May - 20th May? (same dates), now they got a lock on 19th and 20th May and not on 17th and 18th? is that a failed operation? 5) how do I create the 19th and 20th May entry in the first case? lock 17th and 18th? then see oh well 18th is the latest I could get...well after that rooms_available = total_rooms? 2) The booking deduplication logic. Question: 1) Do we also move the cancelled bookings to cassandra? otherwise the hash might result in the same booking_id where the payment failed. The user can't try again? Thank you in advance for your help! 😄
@sanjubaba1339 Жыл бұрын
Hey Aanshul, thanks for this great system design explanation. Could you please create system design for below topics as well. 1. Text streaming - A person is coding and others can watch him code in real-time. 2. Delivery through drones system (with 1 million drones available for delivery). 3. Bicycle renting system. 4. Log aggregation platform. 5. Video streaming. Thanks!
@SCALER Жыл бұрын
Hi Sanjay, we have duly made a note of your suggestion and it will be passed on to our relevant teams. Thank you! 😊
@amitrastogi140510 ай бұрын
Excellent video on booking system design...Thanks!
@SCALER10 ай бұрын
Happy to hear that! 🙌🏼
@gokukakarot63234 ай бұрын
One of the important things in hotel booking and room booking is reviews. Although it’s not that complicated . Shard, replicate and cache. But overall thanks for showing how to present, that’s very helpful
@aman82446 ай бұрын
Amazing video, covered all necessary info
@rabindrapatra71515 ай бұрын
Search is a major functionality. we should add more details into it.
@CaioLouro4 ай бұрын
Great video, lots of in-depth content! I think the search use case is incomplete as filtering by rate is a pretty basic requirement. Besides that, I miss more details on the sharding implementation and strategies, that's complex and usually not well covered
@eprohoda Жыл бұрын
Scaler,Woohoo. like it- breathtaking trip~ 🌟
@Paradise-kv7fn7 ай бұрын
for 1:30:00, I think there might be an issue here. Lets say a hotel has 10 rooms and a user A is trying to book 2 rooms. User B also is trying to book 2 rooms for the same checkin/checkout date. Here, if we put a lock on the entire rows for the checkin-checkout-hotelId-roomId combination, it would unnecessarily lock block either A or B(depending on who gets the lock first) because A and B don't need to wait for the status of each other as the number of rooms available > the number of rooms needed by both A and B(i.e 4). A better way would be to actually decrement the number of rooms available as soon as the book button is clicked irrespective of whether the payment would succeed or not. If the payment succeeded, we don't need to do anything but if it fails, then we can increment the counter again.
@rabindrapatra71515 ай бұрын
what if user A trying to book. H1-R1 and user B also trying to book same H1-R1 on same date.
@Paradise-kv7fn5 ай бұрын
@@rabindrapatra7151 there still wouldn’t be any issues.
@anmolgangwal923624 күн бұрын
i gues hotel_id we can remove from inventory and booking table coz room-type id is there which already has reference to hotel_id , so it will be redundant
@ajitsinghbisht1419Ай бұрын
Hi, Just going through video and noticed that you have created around 2-3 copies of hotel , room and other data in multiple sql and nosql dbs. is this normal for systems to duplicate the data ?
@KishoreKumar-fg6vf6 ай бұрын
Hotel Inventory data is owned by a different service. Could you clarify how Booking service can access the Inventory data? Does the booking service directly query Inventory Database?
@kavitachawla3323 Жыл бұрын
Users can filter search based on rates too. Why can't the rates be stored in ELK?
@Paradise-kv7fn7 ай бұрын
1 - ELK is set of technologies for logging, searching and visualization. Here, we on'y need ElasticSearch to perform searches. 2 - Yes you are correct about the filtering part. We will need to store all the necessary attributes in each document in ES on the which the user can filter on.
@hypein229710 ай бұрын
1:35:40
@InvincibleMan995 ай бұрын
Why Rate consumer svc has to be separate svc? we can create consumer in rate service itself?
@theseriousguy21368 ай бұрын
Can anyone help me in clarifying my doubt? Suppose admin updated the rate of a room by using the Hotel Service, and this is updated in the SQL cluster 1 ( used by the hotel Service). And this hotel service creates an event in the Kafka Queue, and the rate consumer listens to it and updates in the Rate Table maintained in the SQL Cluster2 ( used by inventory service). This updating is an asynchronous task , so might be the case that the hotel price might not have been updated in the rate table of 2nd cluster, and the user is able to book at the older price?
@amanrawat51645 ай бұрын
same doubt. @SCALER
@joshuaokoro94473 ай бұрын
Correct me if I'm wrong, but it seems like when the inventory is decremented and gets to zero, it will block out bookings for rooms on booked and unbooked dates. Example room_type_id = 1 total_rooms = 2 available_rooms = 2 User 1 creates a booking for check_in_date = 2024-december-15 check_out_date = 202-december-18 This decrements available_rooms = 1 User 2 creates a booking for check_in_date = 2024-december-20 check_out_date = 202-december-25 available_rooms = 0 User 3 tries to create a booking for check_in_date = 2024-december-26 check_out_date = 202-december-29 Following the design, this will return a message to user 3 that there are no rooms for the provided date since the available rooms have been decremented to zero. Is decrementing the inventory the way to go, or am I missing something from the explanation that should prevent that?
@yashnasery85013 ай бұрын
The inventory table seems to have a date field as well, so it is like room_type_id = 1 total_rooms = 2 available_rooms = 2 date = 2024-december 14 room_type_id = 1 total_rooms = 2 available_rooms = 1 date = 2024-december-15 room_type_id = 1 total_rooms = 2 available_rooms = 1 date = 2024-december-16 room_type_id = 1 total_rooms = 2 available_rooms = 1 date = 2024-december-17 room_type_id = 1 total_rooms = 2 available_rooms = 1 date = 2024-december-18 Then I think (IDK if it has been covered yet till 01:09:53) since your new booking dates don't overlap, you infer that every room is available, since you date is greater than 18 (latest date for the second booking). Creating this new entry will need again race case checks, as you need to know which booking creates a new entry for a new date first. Now comes two things (again IDK if it has been covered yet till 01:09:53) 1) To see if you can actually book a new booking from let's say 16 - 20, you check the number of rooms you want (in your case 1) is available on each date, if no, it fails, if yes, you decrement (need to check race conditions here). 2) Clean up the table for past dates or completed or cancelled bookings maybe.
@ShivangiSingh-wc3gk4 ай бұрын
A system design interview will be 45 min max, what are the basics that we need to cover for that interview ?
@DmitryKrasnikov3 ай бұрын
look at c4 model notation and try to build c2 scheme at interview. That will be enough for almost all cases.
@InvincibleMan995 ай бұрын
You have not covered the part where a user has to check availability of rooms in future date. Select count(bookings) as bookings_count from bookings where room_type_id=1 and hotel_id=1 and status='Reserved' Available Rooms = Total Rooms - bookings_count
@SopneshGandhi9 ай бұрын
1:23
@rabindrapatra71515 ай бұрын
Estimation does not include storage. It looks like purely scripted rather than experience.