System requirements
Functional:
- Entries and exits
- Floors
- Parking spaces
- Ticketing gate
Non-Functional:
- Consistent operating times
- Secure facilities
- Well-connected to road infrastructure
Capacity estimation
- Assuming large city - 40 cars/hour from 7-9am and 10 cars/hour from 9-4pm. This means we have a total capacity of 150 cars.
- Avg throughput is 16 cars/hr
API design
Parking space api:
-Floor
-Size
-Empty?
Garage api:
-total floor
-spaces []:
-entry price
Car api:
-size
-hour in
-hour out
Database design
Simple database running the garage api and managing the spaces in the garage. garage database is sharded and based on floor assigned to the car
High-level design
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...
Request flows
Car enters the garage, the ticket manager acts as a gateway determining if the car can enter based on the space manager, car is then place in the garage database based upon floor its assigned. the time check runs checking the cache soon to expire times and removing the cars from the garage whos time is up, notifying the space manager that there's space. the cache pulls times from garage that meet a minimum threshold of times about to expire.
Detailed component design
see high level
Trade offs/Tech choices
No tech here, used caches to help manage time checking from garages to ensure quick removal of times
Failure scenarios/bottlenecks
The time check is a massive bottleneck as if it goes down, the entire system of removing cars breaks
Future improvements
Make a priority queue to manage the times and have a counter check it periodically