Daily active user = 80,000
Each user makes 5 shortened url per day
80000 * 5 = 400,000 requests / day
400,000 / 86400 ~= 5 qps
5 * 5 = 25 pqs for peak
Each url shorten request will use about 500 bytes of storage: 100 bytes for original url, 15 bytes for shortened url, some metadata
500 bytes * 400000 * 365 * 3 ~= 205 GB storage used
/shorten
Request { url, user_id }
Response { shortened_url }
/get_history
Request { user_id, start_time, end_time }
Response { [original_url : shortened_url] }
UrlTable
user_id, domain, original_url, shortened_url, last_used, expiration_time
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...
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...
ShortenService - method used to shorten the url
Database - tradeoffs in choosing SQL vs. NoSQL
Eventual consistency
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?