Let's say we have 1M users.
-> every user let's creates 10 new tiny urls every month
-> every url is 10Kb.
-> so every month we will have 100kb to save for 1 user.
-> for 1M users, 1M * 100kb => 100Gb
read:write => 10:1
so if we create 10 urls for every user in a month, that means 10*1M => 10M writes in total.
and 10*10*1M => 100M reads in total
Write API:
/tinyUrl/post
response: http 200Ok + the tiny_url + message saying that your tiny url has been created.
Read API:
/tinyUrl/get
response: tiny_url
Delete API:
/tinyUrl/delete
Users table:
Urls table
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?