The core functionality of the system is relatively simple, so the primary concern for capacity will be related to the scalability of the number of users. For a URL shortening service, we can assume an average of 500,000 requests per day.
The APIs for this service will be as follows:
The database used for this service will be a relational SQL database which will contain two tables which we will call User and URL. In the User table, we will store unique user ID's. In the URL table, each row will contain the new short URL, the long URL used to create it, the user ID associated with the user who requested the URL, and the date of the request.
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...
The user will access the web service, and in doing so will be transferred through the load balancer to one of the available servers. After which, they will login so the service can retain the user ID used for API requests. When the user requests a shortened URL, the service will store the original URL in the database and return to the user a shortened version. If the user provides a shortened URL that was created by the service, the service will return the original long URL.
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...
A relational database was selected for this service since it allows us to maintain structured data, which allows us to look up specific information regarding user activity, for example if they have made a certain number of requests, or if we want to determine how old a request is.
If a user makes a large number of requests and there is no limitations set on the number of requests they're allowed, they could potentially overload the server.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?