List functional requirements for the system (Ask the chat bot for hints if stuck.)...
Need an API to create short url
Api to redirect to actual url
User Authentication for personalized experience
Analytics of usage of url
expiration of url
List non-functional requirements for the system...
since it can be retrieved at any point oftime , our system should be available
Scalable so it can serve to many requests
Fault tolerant
Performance should process redirection under 10ms
security from DDOS attacks
Monitoring
Cost efficiency
Maintainability
Compliance and Data privacy
Estimate the scale of the system you are going to design...
Twitter use this short url and if we take users of twitter to estimate , around 1 billion people use it.
DAU should be around 25% that brings to 250 million.
read write operation , 90% will read while 10 person write
250 million daily read write operations daily
per second
250 million/100000= 2500 req/s
if 1 server need to process in 10ms, 10 reqs per server
250 servers required.
Storage estimation :
if 10% people do write operations
shortly should have 6characters
and url max 30 characters
25 million *100bytes
2.5 TB per day
Define what APIs are expected from the system...
Authentication: Bearer Token
Put v1/create_url
request{
orignalUrl:
expire:
}
response{
shortUrl
}
public api
get v1/redirect_url?url_suffix={}
response {
actualUrl:
}
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
url_table
id
orignal_url
short_url
user_id
user table
id
username
password_hash
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...
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?