High-level design
Non-Functional requirement -
- Data Base
- Meta Data - Dynamo DB
- user profile
- Booking/Payment - SQL
- link user profile against the booking confirmation
- Movies - Dynamo DB
- search movies based on the state/city or zip code
- Queuing
- Kafka
- sequence the user request one at a time to based on first come basis
- Load Balancer - AWS Elastic load balancing/nginx
- distribute the traffic based on the request to app servers using round robin strategy
- Elastic load balancing automatically manages the traffic to appropriate servers
- API server
- Metadata
- Movie DB
- Booking confirmation DB
- Cache
- Redis
- Add new frequently searched to the list
- remove least searched movies
- remove movies that has expired time
- Horizontal
- Hash based sharding
- hash all the booking ID with appropriate key for easy look up of the booking confirmation along with the user data
- linked hash map
- assign a certain time window to hold the reservation for 5 minutes until payment is complete if not remove the reservation hold
- Fault Tolerance
- Leader
- replicate the servers to avoid single failure point of failure
- add servers across multiple region for nearest location and eliminate latency
- Follower
- select the next available server in case of the primary failure
- Rate limiter
- prevent multiple request from the same client
- prevent bot attack
- Security
- user authentication through registration using user id as email along with password
- lock the account if the password fails after 5 attempts
Functional requirement
- Search movies based on the location - state/city or zip code
- Reservation count/Seat selection
- user can reserve a total of 10 seats at one time
- seat selection -
- select even number of seats in the count of 2
- select in a available sequence first if not available then select randomly
- Booking & payment confirmation
- Ticket will wait in the check out queue for 5 minutes until the payment is made
- Once the payment is made the ticket is confirmed and a booking id is generated against it