not in scope
10M users in US
At most 1000 concurrent users interested in a show during peak times, average 50.
10 movies per week playing in 10k theaters in US
GET /movies?name=<>&date=<>&location=<>
Reuired: loc
Reponse
{
"amc": {
"thor": {
"time"[2pm, 6pm], "id":123
}
},
}
GET /show?theater=<>&movieid=123&time=<>
Response
showId: 154
10 seats available
GET /show/seatMap?theater=<>&movieid=123&time=<>
Response: {
row1: [1,2,3,5]
row2: [2,7,8]
...
}
POST /reservation?showId=<>
body
{
seats : [(rowId,seat num)...]
}
POST /book
Movie DB
Theater
Movie
--------------------------------
Shows DB
Show
SeatMap
------------------------
Reservation
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...
When browser attempts to make a reservation, an entry is created in reservations DB with TTL of 15 min. seatMap
If there are many concurrent requests for the same seat map, it may become a hotspot and none of the users may be able to complete their reservation. In case a movie is popular(based on hit rate and prior knowledge), the seat map can have its own shard and each row can be migrated to a separate column.
Rate limiting may be needed to limit bad actors like misbehaving 3rd party aggregators/resellers. An algorithm like token bucket based on source IP can be used. Also a DDOs solution like cloudflare can bve used to prevent abuse of reservations API for unauthenticated clients.
For seat availability display, approximate counters like HyperLogLog can be used to efficiently display weakly consiustent view.
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?