We expect 1 million users to visit us every day, so approximately 1 million tiny URLs will be generated every day which means 1000000/(24*60*60)=12(approx) tiny URLs being generated every second.
The APIs to be included in the design include:
We would use a NoSQL database like Cassandra/MongoDB/HBase to store the URL information, number of clicks, its corresponding tinyurl, start time, end time, etc.
Also we need to store the user login information like username, email, password, etc in another database.
The Schema for URL information storing database would somewhat look like this:
TinyURL:
id, original URL, start time, end time, tiny URL, no of clicks, user id
The Schema for the user login table would look like this:
Users:
user id, username, password, email
First, there should be the client side, which connects with the load balancer, cache. The load balancer connects with the backend server, which in turn connects with the MongoDB database. The database could connect with analysis tools like Hadoop, and Pyspark. We can also use AWS technologies like ElasticSearch for efficient searching operations, and Lambda for automated load or traffic handling. We use base 62 to shorten url in the backend
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?