Amazon OS System Design Round | Reject
3678

This was asked in the system design round. I was pretty confident about my system design capability but I got stumbled around this simple question.
Design a Simple parking Garage.

func req:
Keep it simple
max 5000 lots
don't care about the veh types or cost or payment
Front facing POS + online api has to show available slots
There are sensors to detect the car is parked or not whih has to update db.

My Soln:

table:
Garage

  • garageId (pk)
  • garageName
  • floors

ParkingLot:

  • lotId (pk)
  • isAvailable
  • floor
  • garageId (fk)

api:
GET garage/availableSlots/{garageID}

Design



                                                      [DB]
                                                         |
[UI]  -> [LB] -->[getSlotsService]---------------------->|<---[updateSlotsService]<----(kafka queue)<----[sensor data]
                                                         |
														 |
										[write back cache]

Questions:

  • Which DB? ans: Relational as it has defined schema + indexing make it easier to find
  • How the DB is updated? ans: sensor events pushed to queue + consumer updates write back cache (This was overkill. I guess interviewer expected another PUT end point)
  • How to retreieve slots are available or not? ans: query parking lot table
  • what to do if you get duplicate events from sensor? ans: if the sensor updates the db with correct data then it wont affect anything
  • What to do if you get wrong data from sensor?ans: Hardware failure has to be handled separately
  • What to do if the events do not reach the system? ans: Hardware failures will be difficult to handle + if it reaches kafka it guarentees events are not lost.

RESULT
BOMBED the System Des round. Roast me with this design and comment below how you would have done it.
NOTE: Interviewer repeatedly said dont look for scaling now keep it extremelt simple.

What I Missed
IOT -> Sensor to system communication. In my design how sensor to DB communication is done? REST or any other way?
Metrics -> detect flaws.

Comments (7)