Functional:
Generate shortened url
Redirects shortened url
Non-Functional:
Availability
Scalability
fault-tolerant
Assuming DAU 10 million and each user will generate 1 url per day, that's 10 m urls per day.
Assume each url takes 100 bytes it will be 100 * 10m = 1000m bytes = 1 GB per day.
That's 365 GB per year.
We can use Amazon DynamoDB: A fully managed NoSQL database that can handle a large traffic volume, ideal for scalability and performance.
GenerateShortUrl - returns a shortened url based in input url.
RedirectShortUrl - redirects the shorten url to the original url.
Cassandra has certain operational overhead and we have no need for complex queries.
Given that storing url doesn't require complex relationship we can use a no sql key value store like dynamoDB.
{ "exampleofaveryveryveryverylongurl.com/test/1/2/3/4", "short.xyzab.com"}
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?