Consider Average
Considering peak
7 times the above so
Booking at peak = ~ 1400 req/sec
Visitor at peak = ~ 7000 req/sec
Storage:
Storage for booking in 1 year = 400 in one month = 4800 M in year
Booking need 200 bytes of storage ~ 100 * 10 * 1000 * M ~ 1TB a single instance can easily have this.
GET /api/v1/CinemaHall/{City}
GET /api/v1/Shows/{City}/{CinemaId}
GET /api/v1/Seats/{showId}
POST /api/v1/BookSeat
-d {
showId:
UserdId:
SeatIds List<>
}
POST /api/v1/review -d
{
showId
rating:
reviewDescription:
userId:
}
CinemaHall
ScreenHall
Seats
Movie:
MoveShow
Booking
SeatInstances
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Booking Flow
BEGIN
select pg_advistory_lock('showId-seatId1);
select pg_advistory_lock('showId-seatId2);
select pg_advistory_lock('showId-seatId3);
Insert into booking values(12, userId showid, 'Created'., Now(), 1500);
Insert into bookingSeat values(12, showid, 'A1'., 'On-Hold', 500);
Insert into bookingSeat values(12, showid, 'A2'., 'On-Hold', 500);
Insert into bookingSeat values(12, showid, 'A3'., 'On-Hold', 500); COMMIT;
Listing Flow:
API gateway: The api gateway will redirect the request to multiple services based the request url. It will also do load balancing between the instances of a single service.
User Service: This will handle user login/signup. Manages user profiler.
Listing Service: This will be responsible for the read flow, eg listing movie halls and movie shows.
Booking Service: This will handle the bookings with the help of payment service.
Message Queue: The booking will be persisted in the message queue before the invoice and tickets are created and sent to user.
Notification Service: This will be responsible for sending invoice and booking confirmation.
Cache: A redis cache will be added to store the list api request and responses. This will be LRU based cache.