Back to LLD explorer
Concurrency / Transactional Patterns: Observer, Strategy

BookMyShow (Movie Ticket Booking)

Hard

Problem Summary

Design a movie ticket booking platform handling massive concurrent seat selection, payments, and notifications.

Functional Scope

  • Allow users to browse shows in specific theaters.
  • Ensure seat allocation is highly concurrent: lock seat temporarily (e.g., 5 mins) during payment checkout.
  • Release seat locks if checkout session expires or payment fails.
  • Support multiple payment gateways.

Entity-Relationship (ER) Schema

Theater [1] <---> [*] Screen
Screen [1] <---> [*] Show
Show [1] <---> [*] Seat
Booking [1] <---> [*] Seat
Booking [1] <---> [1] User

Design Approach

Implement optimistic or pessimistic locking on seats to prevent double booking. Use a Redis-based cache to store temporary seat locks with TTLs (Time-To-Live) corresponding to payment checkout timers.

Core Classes & Models

Theater & ScreenShow (Movie, Screen, timings)Seat (Gold, Silver, status: FREE, LOCKED, BOOKED)Booking (Seat references, User, Show, Status)
Code Blueprint
public enum SeatStatus { FREE, LOCKED, BOOKED }
public class Seat {
    private SeatStatus status = SeatStatus.FREE;
    public synchronized boolean lock() { return true; }
}