given long url, return shorter url
given shorter url, able to redirect to original web
support large volume of url storage
support high read traffic
high available
low latency
generate 10/s, 1day is : 10 * 86400 = 800k
1 year, new added is 800k * 365 = 25M
suppose run 10 year: 250M rows
storage need: 250M * 1KB = 250GB
1: geneate(long url) -> shorter url
2: get(short url) -> long url
master slave mode: master for write, multiple slave server for read
geneate query -> LB -> server -> generate UUID to represent url -> store it
query short url -> LB -> server -> read from db and return
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...
read heavy system, so use multiple slave db for concurrent read
Try to discuss as many failure
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?