The SYSTEM should return the TinyURL when a long URL is provided and mapped to a TinyURL.
The SYSTEM should create and return a TinyURL when a long URL is provided, and the long URL is not mapped to a Tiny URL
The SYSTEM should maintain the Tiny URL mapped to the long URL for 5 years.
The SYSTEM should return the long URL mapped tot he TinyURL when the TinyURL exists.
A TinyURL will be defined by 14 bytes, 1 byte of server ID, 4 bytes to represent the date, 3 bytes to represent the time and the last 6 bytes to represent the fractional seconds.
Scalability
Availability
Assuming 10M of Daily Active Users.
Assuming each User will create 1000 TinyURLs per Day: 10M * 1000 = 10 000 M.
GET: Get_TinyURL
{
"TinyURL" : <Tiny URL>,
"Long URL" : <long URL>
}
DELETE: Delete_URL
{
"TinyURL" : <Tiny URL>,
"Long URL" : <long URL>
}
Columnar Database: Cassandra.
TinyURL : Primary Key
LongURL : Secondary URL
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...
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?