Concurrency in an Booking application like Flipkart / BookMyShow

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-10-04Added By Anonymous
Source: Link

How do we handle the concurrency in application side?

we will not be making our service synchronized right ? because that will effect our performance and slowness in the booking..

public void synchronized blockInventory(){
	//decrementing the inventory count
}

eg: One person is booking a hotel for today and other person is trying to book a hotel for tomorrow.

As the above two cases can be run concurrently right ?

How do we implement concurrency in the above case ?

fyi, The above question is asked in MakeMyTrip Interview for Backend developer role

Comments