List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
Assuming 10: 1 read to write ratio.
Everyday we have 1M reads, this will give 30M reads per month and 360M reads per year. Assusming a shortened url will expire in 5 years, since we have 10: 1 ratio, so writes will be 36M. Now, assuming we will store 1Kb data per record, this will give us:
1KB * 36M * 5 = 180 GB of data stored
Also we will have 100 reads/sec
We will have two api, one will be POST for creating a new short url and other one will be GET which will be used for redirection to the original url
I will be using mongo db for storing the records with schema: Original Url, shortened url, created at, expiration time. Indexed at both original and short 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...
Since we are using replica DB for reading the url, there might be some lag as the replication process will mostly be asynchronous
We might have to use rate limiter for request limitaion per user.
We might have to keep checking for URL generation and expiration service as they might fail
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?