I assume:
Storage capacity
10*100*200*10KB parking spot info - 2GB
200 reservation requests/day
200 users/day
10*100*200*10KB reservation info / day - 2GB * 365 * 10 - 2TB for 10 years
writes per sec
10*100*200 requests/ day - 55TPS
-->Book a spot
POST /reserve
Request:
{
startTime
endTime
Username
UserId
vehicleId
vehicleType
}
Response:
{
BookingId
startTime
endTime
Username
AmountToBePaid
UserId
vehicleId
vehicleType
BookingStatus - PAYMENT PENDING
}
-->Pay for the spot
POST pay/bookingId
Response:
{
BookingId
ParkingSpotNumber
startTime
endTime
Username
UserId
vehicleId
vehicleType
BookingStatus - CONFIRMED
ParkingStatus - EMPTY
}
-> Park Vehicle
POST park/bookingId
Response:
{
BookingId
ParkingSpotNumber
startTime
endTime
Username
UserId
vehicleId
vehicleType
BookingStatus - CONFIRMED
ParkingStatus - PARKED
}
--> Exit Parking
POST exit/bookingId
{
UserId
Username
startTime
endTime
}
Response:
{
BookingId
ParkingSpotNumber
startTime
endTime - updated end time
Username
UserId
vehicleId
vehicleType
BookingStatus - CONFIRMED
ParkingStatus - EMPTY
}
--> delete Booking
delete /reserve/bookingId
Response:
{
BookingId
startTime
endTime
Username
AmountToBePaid
UserId
vehicleId
vehicleType
BookingStatus -CANCELLED
}
Use a sql database , as we require the ACID properties for locking the parking spot, and transactional properties for payment systems
Regular archive of data to storage system
Current/ Todays reservation data load to cache for faster access
Reservation System
Payment System
Cache
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
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?