System Design: Movie Ticket Booking (BookMyShow)

Traffic And Storage Estimation

Problem Statement

  1. The system would need to be highly concurrent. There will be multiple booking requests for the same seat at any particular point in time. So proper handling of locking the records and transactions.
  2. There are financial transactions involved. This means that the system should be secure and the database ACID compliant.

Service Creation

searchMoviesserachCityloadMovileloadTheaterbookSeatseatDetails reserveSeat viewBookingloginUser

Database Design

  1. Each City can have multiple Cinemas.
  2. Each Cinema will have multiple halls.
  3. Each Movie will have many Shows and each Show will have multiple Bookings.
  4. A user can have multiple bookings.

Caching

Queue or Event handling

AI and ML process

Application Flow

Ticket Booking Flow

Seat Booking Process

  1. Update the cache to remove the Booking (or mark it expired) and update the seats’ Status in ‘Seats’.
  2. Sync the DB for the seat and booking details.
  3. Notify the user that their reservation has expired.
  4. Broadcast a message to all WaitingForSeatService servers that are holding waiting users of that Show.
  5. Send a message to the WaitingForSeatService server holding the longest waiting user to process their request if required seats have become available.
  1. The server holding that reservation sends a message to all servers holding the waiting users of that Show so that those servers can expire all the waiting users that need more seats than the available seats.
  2. After receiving the above message, the client expires the existing session and it will request to fetch a fresh record of seat details.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store