Assume each URL entry requires approximately 250 bytes.
250 bytes * 100 TPS * 86,400 seconds/day ~= 250 * 100 * 100,000 ~= 2,500,000,000 bytes/day
The daily new storage requirement is roughly 2.5GB data.
Request (JSON)
{
"long_url": "https://www.example.com/some/long/path"
}
Response (JSON)
{
"status": "success",
"status_code": 200,
"data": {
"short_url": "https://short.ly/abcd1234"
}
}
Request (JSON)
{
"short_url": "https://short.ly/abcd1234"
}
Response (JSON)
{
"status": "success",
"status_code": 200,
"data": {
"long_url": "https://www.example.com/some/long/path"
}
}
Use key value store to persist data (e.g., AWS DynamoDB). Here is the table design.
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?