* Customer entries
* Customer exits
* Customer pay
* The system need to be consistent
* The system need to be correct
* 1000 vehicles per day, QPS is approximately 0.01
* 500 parking spaces
GET /v1/park/slots
Get the number of parking slots available
POST /v1/park/entry
{
vehicle_type: int,
time_t: timestamp
}
return customer_id if success
Customer entries to the parking lot
POST /v1/park/exit
{
customer_id: int
}
Customer exits
POST /v1/park/pay
{
customer_id: int,
payment_details: json
}
I would use a relation database like PostgrasDB. I would create the following tables.
parking
This table store the total number of available slots and slots occupied by customers.
customers
This table stores the customer information.
Similar to high level design.
Since the QPS and number of customer per day is small. A single server with a replica should be able to handle the services.
No needed for this problem.
Since the services are stateless, and can be easily scale horizontally. There is no single point of failure.
No needed for this problem.