Performance(latency, hight throughput), scalability(vertical/horizontal), availability, security, reliability, consistency etc
Number of parking lots = 1000
Parking lot capacity = 200
Reservation requests = 200 * 1000 = 200 000
API used by user:
checkCapacity(lot_id, vechile_type, start_time, end_tine) [is_free, price] - checks if parking lot has a free spot and returns price
reserveSpot(user_id, lot_id, vechile_type, start_time, end_time) -
returns reservation_id and price. Also forwarded on 3d party payment system.
completeReservation(reservation_id, payment_token) - after payment we need to complete payment procedure
API used by parking lot:
vechile_arrived(reservation_id, time)
vechile_left(reservation_id, time)
Reservation table:
User table:
Vechile table:
Spot table:
Parking lot - notifies when car arrive or left
Client - user , that wants to get parking spot
Api gateway - mediator fro http requests
Reservation service - checks for empty place and update reservation in database
Payment service - 3d party for payments
checkCapacity request handles by reservation service. It checks if we have an empty spot.
reserveSpot request - handles by reservation service. Adds. a new reservation in the system and redirect user for payment service.
completeReservation - after payment, user confirms that spot was paid by token.
vechile_arrived - notifies, when car arrived on parking lot.
vechile_left- notifies, when car left from parking lot.
For reservation we can use first fit slot allocation or time-slot reservation with time intervals
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?