List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
System should scale
Low latency, user should get a response saying bid was succesful.
Service should always be available for bidding
System should scale when there is a sudden burst of traffic
when concurrent users are trying to bid for the same product. it should support
Estimate the scale of the system you are going to design...
500M users can use the system for auction.
System is write heavy.
Define what APIs are expected from the system...
POST - v1/user/auction/product - creation an auction for the product. User creates an auction for a product
{
user_id
product_id
}
response
{
auction_id
}
Concurrent users autioning the product shoudl be handles gracefully.
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
DB attributes
product_id
auction_id
creation_date
updation_date
amount
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. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Service takes the requests from user on the product for auctions and push it to the queue. consumers pick it from the queue and write to the DB in a single batch and also updates the count into the cache. key is auction id and value is count
when client calls the service, service looks into cache to see if count > X if yes, it will throw message in real time that product is already sold.
another process runs to sort the auctions based on the amount and send a webhook notification to the user that user had won the auction.
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
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?