The system allows users to shorten URLs:
Performance requirements:
Availability:
Reliability:
Security:
Users and traffic growth:
Requests estimation
Storage requirements:
string ShortenUrl(string longUrl)
string GetOriginalUrl(string shortUrl)
string DeleteUrl(string shortUrl)
string SuspendUrl(string shortUrl)
There is no very complex relationships in the data model. We can consider a NoSQL technology (key-value store for instance) in order to scale better.
The service is more read intensive than write so it can scale by adding more read replicas of the database.
The url lookup can be made faster by using a distributed cache.
Url entity
User entity
The client can be an anonymous user who clicked on a short URL or a authenticated user who wants to edit urls.
A load balancer is used to distribute evenly the requests from all users among serveral application servers. It could also be used as a rate-limiter.
Reading: servers will look for the urls first in the distributed cache and then in the database if the requested url isn't cached.
Writing: requests are pushed to a distributed queue so the service can handle peaks
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?