(5 cars parking and departing/second) * 60 seconds * 60 minutes * 24 hours * 365 days * 5 years = 788 million
Assume every database entry is about 500 bytes = 394 GB
(10 users reserving/second) * 60 seconds * 60 minutes * 24 hours * 365 days * 5 years = 1.6 billion
Assume every database entry is about 500 bytes = 788 GB
The client will connect to a load balancer to balance the requests made to the server. Client will also connect to CDN to access static content for better performance.
The load balancer can direct to the server which points to different services. We will have the reservation service which will handle all reservations and payment related actions. We handle both in the same service so that if payment fails, reservations should also fail. Payments can be sent to a message queue which will be sent to an external payment system. We will write all items to a write through cache which will directly store that into the database. All the services will check the cache first and if we get a cache miss, we will check the database.
We will have multiple database instances, with a lookup table that maps a parkingLotId to a different shard. For example, we can have a lookup table that looks like:
{
lot1: database1
lot2: database1
lot3: database2
lot4: database3
}
The database will only store information on the lots that are mapped to it.
If user arrives at the lot, the lot will access the CheckIn Service to check the user into the lot. If the user leaves the lot, the lot will access the CheckIn Service to check the user out of the lot.
Once user parks, the lot will access the Parking Service to mark in the database that the user has parked.
Reservation Service
Parking Service
CheckIn Service
TradeOffs/Tech Choice: