Assume daily active user is 10m.
Read QPS: 10m / 100k = 100
Peak read QPS: 100 * 2 = 200
Assume 10% user bid 1 item per day
Write QPS: 10m * 10% / 100k = 10
DB usage capacity:
Each bid may take up to 1kb to save.
Daily DB usage: 10m * 10% * 1kb = 1GB
Yearly DB usage: 1GB * 400 = 400GB
We need 3 replica. So yearly DB usage: 400GB * 3 = 1.2 TB
REST api:
WebSocket message:
I choose SQL db.
The main schema of Item table:
id (primary key)
name
highestBidId (reference key to bid table)
The main schema of bid table:
id (primary key)
itemId (reference key to item table)
status (enum: bidWon, bidLoss, bidComplete, bidFail)
price
createdAt
updatedAt
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?