A: Create short alias URL from original URL
B: reroute short alias URL to original URL
latency:
we need B requirement (reroute) to be at most 10 ms
A can be slower, maybe 1 second
scalability:
300,000 creates a day
1,500,000 reroutes a day
availability:
reads are the most important
consistency:
eventual consistency is good enough
4200 bytes * 300,000 per day = 1,240 mb
50 terabytes for 10 years
createAlias(url: string, user_id: string (uuid), experation_time: string? = None)
reroute(alias)
we will use a NoSQL because it's more performant, the data is not specifically
alias:
id: 8 byte string PK
URL: 2048 character string - up to 4096 bytes SK
created_at: 16 byte string
user_id: 16 byte uuid string
user:
id: 16 bytes uuid PK
created_at: uuid
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...
client can
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?