The user will be able to upload (post) long URL and get a shortened URL
The user will be able to get the long URL using shorten URL
The users should be able to get the response within 0.5 second
Daily average users: 1 million
request per second received: 120 requests / s
Peak: < 250 requests / s
Restful API
using key value database, the key is the shortened URL after the hash function and the value is the long (original URL)
From the high level, the load balancer distributes the clients requests. send it into the hashing server
The server interacts with the database
The clients send requests through load balancer, categorize into post, and get requests.
If the clients want to post the URL, it goes through the hash function and store the (shortened URL, original URL) into the database. If the shortened URL exists in DB, that means we might have hash collision, we append a predefined suffix and hash again until we find a slot
Read
The clients make request to get from the shortened URL, the server will look up from the cache first, if not found it will then query from data base.
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?