I think the best approach was a 2 phase write on cache and on completion update DB. So 1st request comes -> update the cache of seat id's as "processing" so that the next request don't overlap. Then let's say you need to fire n number of events till your booking is done and the payment is complete. Or you need events when the payment fails. If payment fails the cache is written again and changed from processing state to open state. If payment succeeds update the key value to reserved and write changes to DB. For an overlapping request we need to verify central cache and if found processing / reserved send fail status. It's important to get that - if your booking request takes 200ms (to cover all events and get responses) To write a cache value across a seat at the start of processing 1 booking request takes 5ms and you don't wait other incoming request for 200ms ... let me know what you guys think.
@charan7753 ай бұрын
43:00 why is queue required here for concurrent bookings? can't this be implemented using optimistic locking? whichever intent comes first, we update their status = locked so other two booking intents are going to fail because they needed to update on open status row only cause if I open two tabs simulatenously and try to book overlapping seats then one of them fails
@swamysriman71473 ай бұрын
I guess they were assuming lockless or local lock design there.
@charan7753 ай бұрын
@@swamysriman7147 wont lockess design have lesser throughput? because we are processing one request at a time for each section of the seats
@Golbyzshorts3 ай бұрын
Hey gaurav, I have a query.i have a cron job in which I have a scenario of same row getting inserted by multiple thread through concurrency which I want to avoid.how can we achieve this? Technologies used: jpa springboot webflux
@AravinthRavichandran-n1k3 ай бұрын
hi rocker what is the primary identifier for the datal; try using unique constraint. if it is a update operation try using pessimestic locking if it is a fresh record find out why multiple threads are working and producing same data
@RohitKumar-ve3fi4 ай бұрын
will the booking be synchronous? how long does the server keep the connection of the client? let's say user has to wait for 5 mins in the queue, will the user see a buffering in the device?
@dhruvgupta26344 ай бұрын
Must needed video after Coldplay's concert tickets demand.... 💀 Bhaiya, aapko mili kya ticket? 🥲
@lakanavarapunagamanikantaa72994 ай бұрын
how we can scale the event queue service
@patelaryan09144 ай бұрын
event queue is not a service we need to scale we just need to handle the single point of failure as multiple request comes it just goes into queue
@himanshubanerji88002 ай бұрын
Can we have more of these please
@ayushgupta-je8kx4 ай бұрын
Cant we use versioning to prevent double booking?
@charan7753 ай бұрын
same doubt
@charan7753 ай бұрын
40:30 isn't this wrong? not updating status from locked to open even though technically its open.
@B-Billy3 ай бұрын
Yeah, it got missed... the bookingStatus will be 'Booked'.
@keeplearning81024 ай бұрын
At the end you have make it like, i will provide you seat number, customer dont have that liberty, this is not going to wrk