-> Vehical entry and exit management
-> Parking space optimisation
-> User Authentication and Payment
-> Real-Time Parking Availability
->Security Monitoring
->ERT
-> Admin dashboard
2.Average influx and outflux
Avg influx : 1 vehical/minute
Avg outflux : 1.5 vehical/minute
3.Slot stauts update event rate 1 event/second on a slot
4. System should be highly available
5.System should be resilient to failure
6.Secure
7.Performent
8.Parking slot provided should be highly consistent.
500 * 1 event/sec= 500 event/second
24 * 500 * 100 = History events
Storage for slots
1 slot need 1Mb
500 * 1Mb = 500 Mb storage needed for slots
Occupancy event storage
1 event/second per parking slot
500 events/seconds
State change event storage
24 event/day * 500 = 12000 /day
1 month state change history need = 30 * 12000= 360000 events
1 state change event = 10 kb
total storage for 1 month= 36Gb
Stage change event processing speed
We need a real time update of the parking slot we should process 500 events/seconds within 1 second and final state should be updated in resulting storage.
-> API to onboard vehicle
HTTP POST
v1/parking/onboard
Request: {
vehicalNumber: "",
VahicalImage: []byte,
EntryTime:DateTime,
}
Response: {
id:UUID,
entryTime:""
VehicalNumber:""
ParkingSlot:""
NavigationPath:[]
}
-> API to exit from parking slot
HTTP POST
v1/parking/exit
{
id:UUID,
entryTime:""
exitTime:"'
VehicalNumber:""
ParkingSlot:""
NavigationPath:[],
paymentMode:{
txnId:"",
amount:""
}
}
response:
{
id:UUID,
entryTime:"",
exitTime:"',
VehicalNumber:"",
ParkingSlot:"",
exitMessage:""
}
-> Storing parking slot information. Parking slot show transactional behaviour so i will chose RBDMS for storing parking slot data.
-> Storing parking slot event change: Events once stored will not be modified but it keeps appending. But may need some analytical operation on top of it. I need a Horizontally scalable DB(Sharded ) and Higlhy available(replicated) and which allows search, filtering and sorting operation on the content.
MongoDB is one of the good option.
-> We need a storage for payment history done by user.
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...
CheckIN flow
Optimal Parking slot calculator flow. This is to derive the optimal number of parking slots in various space of the system
Event Flow:
ParkingSlotOptimizer
Notification Service
Internally it receives events every 1 seconds based on the state provided by parking lot sensors. Noticiation service store last event in in-memory cache like redis (sharded and replicated) on every new event it will check event stored in DB and if there is delta/change then new event is persisted in the event-state-change DB.
We need efficient diff alogorithm to find event diff.
For parking slot store RDBMS is chosen since data is transactional.
RDBMS will have replicated read-replicas but if primary crash there will be down time during auto recovery
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?