List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
10,000 visitors per day
Around 1 read per second
500 daily users that purchase a ticket
Less than one write per second
Define what APIs are expected from the system...
GET /v1/movies - returns the movies nearby
POST /v1/reservation - Reserve a ticket to a movie. The reservation is a hold on a ticket until the payment is processed
POST /v1/ticket - Reserves the actual ticket
(admin)
post /v1/movies
post /v1/theater
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
Here are the entities that the system will need to track
The user profiles, theaters, movies and purchased tickets can all be stored in a SQL database. We can use Postgres because it supports geosharding which will be helpful for finding theaters near you.
The reservation system and available seats can be stored in a Redis cache because we need faster writes to help avoid conflicts. We can utilize Redis increment functionality to when reserving a ticket.
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...
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Another option is to use a SQL database for reservations and utilize transactions in order avoid conflicts on the reservation. However, when we scale the database and add partitions, transactions will be much slower with a two phase commit. This is why I have decided to utilize the Redis approach for Reservations.
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?
Include more details about the Admin APIs