Skip to main content

Design a movie ticketing platform

Greetings!

Movies are everyone's fun hobby. Designing a movie system is even more fun. We can design mainly 2 systems;
  • System to support a single theater (or group)
  • System to support all theaters
What I am interested in in this exercise is the high-level architecture of a system to support all theaters, which is a movie platform.



These sorts of systems are not built overnight. It takes a lot of engineering effort, designs, re-designs, etc to achieve the desired output.

User requirements

Our main requirement is browsing movies and booking a ticket. Other than that, we can add a few more useful features.
  • Browse available movies in nearby cinemas
  • Book a ticket with online payments
  • Find movie information
  • Notifications
  • Recommended movies
  • Comments and ratings
  • User Registration
  • Cinema registration
We also need our system too;
  • Better response time
  • Searches by movie names
  • Secure payments

High-level design

At a very high level, our system will look like this.



We are going to explore and expand the back end. Before that let's see why we need this cinema-api or external cinema systems.

Handling concurrent reservations

Movie tickets can be reserved using various platforms other than ours. Hence handling concurrent reservations or mainly not allowing multiple users to book the same seat is a big challenge. Can we do this on this platform? No, it is not possible and not the best way to handle this. That logic should be closer to the actual cinema as it might be connected to other platforms as well. Cinema can provide a lock, timeout kind of mechanism so that other consumers can use it. Hence, it is out of our platform and this is why we need cinema-api.

Component break down

As there are multiple ways to design such systems, I would like to put this into the microservices world.



Let's discuss a few of these components.

Search and movie listing

This is a very important feature in the system because users find available cinemas by searching. How can search in multiple cinemas? We need to implement our search module. This can be done using Elasticsearch. When new movie times are added we need to sync that information in our search database. In that way, we can search movies by name, the cinema name, and the city.
 

Synching data from the cinema to the search module is a different challenge. We can have multiple options here.
  • Pull from cinema servers
  • Push by cinema servers
  • Use a message broker

What if the cinema service is not available?

As we are relying on 3rd party cinema service, there will be situations where that service is not available. Our system should behave properly even in these situations. We can handle this by using a simple try/catch but that will introduce a resource wastage as network sockets will be blocked until the call is timeout. The best way in the Microservices world is to use a Circuit breaker.

What if there are many calls?

When a super hit movie is out, we can expect a sudden peak in requests. However, these 3rd party cinema services might have implemented rate limits or even will not be able to handle such high traffic. We can either use a synchronized call and fail it or use a queue. That depends on the business model. In this case, however, failing and letting the end user retry will be better as seats are locked by the cinema service.

Movie recommendations

Recommendation systems are very common in e-commerce platforms. We can collect movie searches, and purchases and use machine learning mechanisms for this. This should be it is own topic anyway.

Other considerations

As in many other systems, we will need caches (Redis, CDN) to have a better performance. There is also a security aspect, load balancers, containerization, and so on. However, I have added only the things I am interested in this exercise.

References

https://medium.com/@narengowda/bookmyshow-system-design-e268fefb56f5

Comments