List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
Writes
1 million pastes per day, 12 requests per second
Peak times 10x the average so 120 per second
Reads
System is read-heavy, each paste likely to be read many times more
read:write ratio of 5:1 60-100 reads per second on avg to 12 writes per second
In more extreme scenarios with a read/write ratio of 100:1, read traffic could reach ~100 million per day (~1200 reads per second),
Define what APIs are expected from the system...
Key entities
Users should be able to submit text they want to store and share
The system should handle plain text content
Users can specify expiration time for the past after which it is deleted
POST /pastes -> Paste
body: {
text,
expiry,
}
Paste { id, expiry_time, text, url, email=null, }
Users can use the service without creating an account
Each paste should have a unique URL or ID so it can be accessed later
GET /pastes/{id} -> Paste
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...
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...
POST /pastes -> Paste
body: {
text,
expiry,
}
Paste { id, expiry_time, text, url, email=null, }
Request routed to our backend API server through API gateway which would provide some security for us. The API server would create a new paste in the database because it doesn't exist.
GET /pastes/{id} -> Paste
Routed through to same API server which retrieves data about the paste and returns it back to the client
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...
Now we will adapt the design to suit non functional requirements
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?
Add a CDN layer to further improve performance and reduce load on backend