create a unique shorten url for a given long url
Redirect request with shorten url to long original url
stable response for generating new short url and quick redirecting from short url to original url
handle multiple requests at the same time
200 rps for generate short url
20000 rps for redirecting short url to long url
get(shorten_url) -> return long_url
post(long_url) -> generate short_url and store it in database
shorten url to original url map(key value: short_url original_url) for quick lookup and redirecting. Redis is a good choice. Also we can have a cache layer for quicker look up
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...
1) shorten request: user input a original url in client, server process this input and generate a short url to store in the database and return the short url to client so the user can share it
2) redirecting request: when user enter the short url, server receive the request, and then lookup in the database to get the original url, send the original url back to the client to redirect in browser
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?