there are 2 main types of users for the system:
In order to make this system work we need quite a few parking lots operators to sign up, as the drivers will only use the features to find parking.
So the suggestion is to go to a Municipality and convince them to use their parking lot for this startup.
We will start by designing for municipality parking - (and maybe a few private operators) in a city of 100,000 population. So about 30-70 parking lots in the city. And about 20,000 drivers in peak hours.
We will need to store data about each driver (2MB) and about each parking lot (50MB)
So we need about ~40GB storage for drivers, and about 1GB for parking lots. So storage wise we will need about 60GB of storage (to handle sudden growth).
We expect about max of 20,000 requests in peak hour so it is about 500 requests per minute. Since most requests will be about finding a parking near me, we will have most of the data and they will only send their ID and location. So bandwidth wise we wont be needing much. Lets say 50Mbps.
Tables:
Indexes:
Architecture: Microservices with API Gateway, Load Balancers, Caching, and Geospatial Database
Components:
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...
Search Service
ST_DWithin to find lots within radius.Reservation Service
BEGIN;
SELECT * FROM ParkingSpots WHERE spot_id = X FOR UPDATE;
INSERT INTO Reservations (...);
COMMIT;
lot_id (e.g., 10 shards for 70 lots).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?