Airline Reservation System - Distributed Transactions, Serialisation, Linearisation, Consistency

  Рет қаралды 55,397

Vinayak Sangar

Vinayak Sangar

Күн бұрын

Join the discord community to share more learnings on system design and distributed systems:
/ discord

Пікірлер: 73
@abhishtsingh6073
@abhishtsingh6073 11 ай бұрын
This was one of the best system design videos I have seen. You didn't brush over important concepts, went into good low level details and first principles and compelled me to take out my notebook and take notes! I really wish you make more of these!
@shivaakrish
@shivaakrish Жыл бұрын
This is one of the most underrated video! It deserves more views.
@user-dn1wl3ej7z
@user-dn1wl3ej7z 3 ай бұрын
Great video !! Clearly explained everything in a simple manner. Thanks so much.
@yashsaliya4475
@yashsaliya4475 11 ай бұрын
your explanations made me understand how to ask questions with the interviewer and how to discuss the details of the system overall fantastic experience 💯
@manueldiera6781
@manueldiera6781 3 ай бұрын
Such a great video, excellent content presented in a very well balanced way. Thanks!
@VishalThakur-wo1vx
@VishalThakur-wo1vx 2 ай бұрын
Great video. I have some feedbacks. 1. Talk about Orchaterator vs Choreographer pattern. Booking Service is acting as a Orchasterator . We can also use decentralized system like Kafka. 2. 2PC is generally not practical to achieve distributed transaction. A better approach would be SAGA pattern and having compensating events. 3. Also, talk about creating some derived data. For example, is a flight is booked completely . Keep this info in cache and keep cache in sync with DB so that cancellation would mark this booked flight to available.
@manjeetkumar
@manjeetkumar Жыл бұрын
You explained flight booking flow in quite detailed manner while focusing on all important topics. Which i really liked. I have seen so many videos on system design, usually people don't dive deep into these concepts. You did everything in balanced way, which makes this presentation perfect.
@ishaarora3
@ishaarora3 Жыл бұрын
Great explanation. Appreciate that you took into account the scale part and actually discussed the numbers. Thats an important part and some interviewers like to ask it for mainly senior roles. Thank you!
@sajeethabegum4740
@sajeethabegum4740 6 ай бұрын
Concepts are clearly explained and Easy to understand. Thanks for making this video.
@santoshbhatnagar2155
@santoshbhatnagar2155 2 ай бұрын
Really nice and in-depth video.
@AmitAgrawal-xu8uk
@AmitAgrawal-xu8uk Ай бұрын
Very Nicely explained !!! Best video for this topic ..thanks for sharing
@vinitamaloo107
@vinitamaloo107 Жыл бұрын
Such a detailed video. Thank you!
@sandeepbaldawa9146
@sandeepbaldawa9146 Жыл бұрын
Beautifully explained! good one
@aunghtayoo337
@aunghtayoo337 11 ай бұрын
Thanks for the quality content.
@sristijaiswal1013
@sristijaiswal1013 27 күн бұрын
Very detailed video. Thanks a lot.
@andersondamasceno
@andersondamasceno 4 ай бұрын
Very good explanation. Will aid me in my quest of learning system design.
@rahulsinghishere
@rahulsinghishere 4 ай бұрын
Thanks, this is very useful for me, really appreciate your efforts
@ahokai
@ahokai 10 ай бұрын
great video and thank you for sharing. I have a few comments. 1) about calculating TPS, it should not be considered using a daily estimated traffic, because traffic normally is not distributed evenly and it fluctuates. It is important to think about TPS as exactly "how many transactions does your system need to support per sec in the worst case scenario at any given time of the day". 2) avoid using distributed locking, 2-phase commit is complex and should be avoided. use some sort of recovery mechanism instead. 3) not sure about locking seats using DB locks, you can use DB to lock rows, tables or even columns for certain DBs but what you need here is some locking mechanism that you will need to design on top of DB locks to achieve atomicity or simply an in-memory cache can also do the job. 4) optimistic locking is designed for high concurrency and pessimistic locking kills concurrency.
@koeber99
@koeber99 6 ай бұрын
You said to "avoid using distributed locking." Well then how do you handle/create a ticketing system (ticket master), with millions of users but only 100K seats event for every popular concerts/ sporting events? In big events, there will be high demand in a short period (hours) trying to buy the few tickets.
@mallikarjunmannam8225
@mallikarjunmannam8225 11 ай бұрын
nice explanation and great work
@squ34ky
@squ34ky 10 ай бұрын
Excellent analysis.
@LeoLeo-nx5gi
@LeoLeo-nx5gi Жыл бұрын
Thanks a ton!!! Quite clear and amazing
@sangarvinayak
@sangarvinayak Жыл бұрын
Glad it helped!
@YouTubers-rj9xv
@YouTubers-rj9xv 10 ай бұрын
Anna please don't stop uploading videos. We love you 💘 excellent teacher.
@heathergrey_
@heathergrey_ 10 ай бұрын
this is so so helpful thank you!!!
@chandranshudubey150
@chandranshudubey150 Жыл бұрын
Very Nicely Explained.
@SunnyKumar-ud9gp
@SunnyKumar-ud9gp 2 ай бұрын
The content is amazing
@RM-bg5cd
@RM-bg5cd 10 ай бұрын
One thing you could do for the payments is simply process them later. At the moment what you need to fetch from the user is a payment method and this is something you can setup with Stripe. So if you manage to get a payment method, temporarily store in the database along with your booking and the seats, and bundle that in the same unit of work, you could then use a transactional outbox pattern to process the payment later. If something’s wrong with the users payment method you remove the seats and make the booking available again, this would free you from dealing with the refund service altogether and turns the system into a more event and domain driven system.
@koeber99
@koeber99 6 ай бұрын
In the real world, I don't think the business side of the company is going to like this approach. The company wants to lock in the sale! The customers would assume their airline tickets are booked and go to the bed at night then straight to work in the morning. They may not see your notifications for hours or even days after the failure. What do you do with the seats in the meantime? Hold them? What happens if the customer changes their mind? Then you hold on for seats for 24 hours for nothing! If you don't hold the seats, then I miss my flight. In my opinion, it's better to fail fast! The customer would pull out another credit card and buy the ticket! The money goes into the company bank account!
@freezefrancis
@freezefrancis Жыл бұрын
Very well explained.
@alphabeta644
@alphabeta644 10 ай бұрын
Is it possibly or advisable to switch between optimistic lock and pessimistic lock on the fly? For example, if the airline seats are
@AnubhavApurva
@AnubhavApurva 10 ай бұрын
Thank you!
@gopalgowda9899
@gopalgowda9899 10 ай бұрын
good job gentelmen!
@shubh191
@shubh191 2 ай бұрын
Thank you very much sir for informative video. This is really very helpful. It would be great if you could create video for coding for this airline system
@guitarkc5522
@guitarkc5522 6 ай бұрын
fantastic video, would be even better to show how the site architecture will interact with multiple GDSs, airlines, and NDCs in real life scenarios
@adityakirankorlepara4500
@adityakirankorlepara4500 11 ай бұрын
Very well explained
@royalgoa
@royalgoa Жыл бұрын
Hey, I have a question on the flight information and flight seat information table. I am trying to understand how you handled concurrency in the system. Are you implementing concurrency control using materialized conflicts? Are you going to have a record present for each flight-seat in the table even before a booking happens and then use locks to handle concurrent requests for the same seat?
@akhileshkumar-jy4ql
@akhileshkumar-jy4ql 10 ай бұрын
Very informative
@tonyyang8424
@tonyyang8424 9 ай бұрын
I think in the reality, when customers are searching "available" flights, they are expected to get flights with availble seats, not the flights without seats. This means in the search path, we also need to visit some kind of inventory table to query available seats. Also, the flight table does not consider the situation that with one flight like "AA101", the flight will re-fly for the same routes iteratively, it is not one row can suffice that in the flght table.
@adityalahiri4529
@adityalahiri4529 2 ай бұрын
i also think this key aspect got missed
@TheKshitijagrawal
@TheKshitijagrawal Жыл бұрын
Suggestions - for flight information table, we have primary key as flight id but most relational dbs create unique index on primary key across partitions so we shall better than flight id and departure date as composite primary key. Though I like the idea of departure date as partition key. Here, we are assuming that if same plane does multiple round trips between two destination, each will have a separate flight id on given day. Also, instead of booking open, we can call that column as booking status - instead of just open and close, there could be more status like flight cancelled.
@ethanz4928
@ethanz4928 9 ай бұрын
I thought each flight is unique in this world isn’t it?
@TheKshitijagrawal
@TheKshitijagrawal 9 ай бұрын
@@ethanz4928 of course flight Id is unique. The concern here is not about uniqueness but accessing data faster for most common queries. As far as possible query shouldn't require search across partitions.
@ishaancse1994
@ishaancse1994 4 ай бұрын
Really helpful
@uditagrawal6603
@uditagrawal6603 9 ай бұрын
Date should also be part of seat information as booking status for a seat would be specific to date, same seat can be booked on one day and not on another.
@niranjhankantharaj6161
@niranjhankantharaj6161 9 ай бұрын
In scaling estimates for flight seat info table,100B*100*100*365 = 365,000,000B ~ 365 MB... i see its 3.65GB. should that be 365 MB? please explain.Thanks!
@saelkhlouf1695
@saelkhlouf1695 Жыл бұрын
Thanks man, could you tell me which tool do you use for the drawing ??
@santoshbhatnagar2155
@santoshbhatnagar2155 2 ай бұрын
how does the movie booking companies handle the locking part, does this decision depends on the criticality of the usecase, for example we are okay with the user to retry here, we can take an optimistic locking and in other ways we choose pessimistic locking.
@sweetphilly2
@sweetphilly2 10 ай бұрын
The flight id in the Flight Seat Info is technically a Foreign Key, right? Seeing two PKs throws me off since I'm pretty sure you can't have two in a table
@quarantine_made_me_do_it9014
@quarantine_made_me_do_it9014 Жыл бұрын
Great explanation! Thank you so much for the video. One question though, you mentioned towards the end that databases should support linearization/consistency, can you please tell how to actually achieve consistency in such a distributed storage system with multiple read/write nodes?
@edgecase6788
@edgecase6788 7 ай бұрын
yes i agreee i did get same question in google and and I got offer.
@lokeshmehta9591
@lokeshmehta9591 9 ай бұрын
this is called content.
@jeremyshi4082
@jeremyshi4082 4 ай бұрын
one small nitpick, the partition key on departure date doesn't make lots of sense. It can easily introduce scatter and gather problem if user searches a range of date. srce-destination is a good choice based on the access pattern.
@Adi-yi6qq
@Adi-yi6qq 4 ай бұрын
Departure date partition key makes perfect sense. Why would anyone search for flights using a date range? Nobody provides such a feature either. Flight search is always done for a single date.
@Alex233xx
@Alex233xx 4 ай бұрын
some src destination can be hotter than others, so it wouldnt make a good partition key. partition on flight id with departure date as sort key is probably a better option imo
@Gerald-iz7mv
@Gerald-iz7mv 6 ай бұрын
Can you use saga pattern instead of a 2 phase commit?
@rumtek3559
@rumtek3559 7 ай бұрын
No stones unturned !
@Gerald-iz7mv
@Gerald-iz7mv 6 ай бұрын
Is pessimistic and optimistic lock implemented as a feature of the database?
@rahulaga
@rahulaga Жыл бұрын
nice content !! appreciate if you can zoom in bit.
@prabuddhadas935
@prabuddhadas935 10 ай бұрын
i liked the the sound of water pouring
@kidsarena4821
@kidsarena4821 7 ай бұрын
Search service can have caching to reduce db read queries as most data may be static
@abdulgafoormn
@abdulgafoormn 4 ай бұрын
Scenario : Lets say while booking a seat, a seat is locked and ttl is set. After payment and updating booking status, it should update the seat state to 'BOOKED'.But we know that the same row is already locked and the update would fail, which would make the entire booking fail.
@ankur20010
@ankur20010 9 ай бұрын
Why can't we say that the search service should also be highly consistent? What if it is not consistent? If it is not. It can show seats as available which are actually not available
@chrishabgood8900
@chrishabgood8900 10 ай бұрын
you need row locking so the seat will not be available
@atabhatti6010
@atabhatti6010 6 ай бұрын
Your flight seat information estimate (25:07) is off by a factor of 10.
@user-bv2uc4rs9k
@user-bv2uc4rs9k 6 ай бұрын
Hello, we are dedicated IT service team providing dedicated IT service to your business, we are looking forward to hearing from your team
@soumik76
@soumik76 10 ай бұрын
You've completely ignored the complexities of search. How do you search for 1- stop and 2-stop international flights? Which db would you use? How would you distribute that kind of data? You'd need a graph db to sort this out. You don't even mention that
@09TYPER
@09TYPER 10 ай бұрын
Really?How about you make a video about that?
@SumanthReddyAdudoodla
@SumanthReddyAdudoodla 2 ай бұрын
🤣🤣
Do you know Distributed transactions?
31:10
Tech Dummies Narendra L
Рет қаралды 225 М.
Pray For Palestine 😢🇵🇸|
00:23
Ak Ultra
Рет қаралды 34 МЛН
Ну Лилит))) прода в онк: завидные котики
00:51
Design Twitter - System Design Interview
26:16
NeetCode
Рет қаралды 450 М.
System Design Interview: Design Ticketmaster w/ a Ex-Meta Staff Engineer
58:39
Hello Interview - Tech Interview Preparation
Рет қаралды 30 М.
Top 7 Most-Used Distributed System Patterns
6:14
ByteByteGo
Рет қаралды 229 М.
Cache Systems Every Developer Should Know
5:48
ByteByteGo
Рет қаралды 439 М.
Design a High-Throughput Logging System | System Design
8:23
Interview Pen
Рет қаралды 40 М.
How I Mastered System Design Interviews
10:22
Ashish Pratap Singh
Рет қаралды 80 М.
Design a Payment System - System Design Interview
31:40
High-Performance Programming
Рет қаралды 411 М.