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 attact
Request flows
Meta DB
Movie DB
movie theatre service
check out service
payment service
Detailed component design
Dynamo DB
Kafka
Kafka
For asynchronous communication between microservices, we will leverage Kafka as a distributed messaging system. Kafka’s fault-tolerant and scalable architecture makes it ideal for handling large volumes of data and ensuring reliable message delivery
we can have multiple producer and consumer request queue based on the FIFO strategy
if one of the queue fails then take the last failed request to a different queue and start processing from there based on the time
Horizontal sharding
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
eliminates concurrency issue in DB
Trade offs/Tech choices
Dynamo/ CasandraDB
No-SQL
for storing the meta db with additional information as we scale
Dynamo DB automatically scales based on the load
replicates copies across multiple regions
fail safe to different region if one of the server goes down