SD-3 · System design
Design a Pastebin
Asked at Mid level45 minutes
Our answers stay hidden until you reveal them.
Question
Our solution
Design a service where people paste a block of text, such as code, a config file or a log, and get back a short link like paste.it/Ab3dE9xQ. Anyone with the link can read the paste, as a highlighted page or as raw text, and the creator can delete it. There are no accounts.
The service takes 10 million new pastes a day, and each is read about 10 times. Pastes average 10 KB but can be up to 10 MB, and can expire after a set time. The hard part is not the request rate but the bytes: about 100 GB of new text a day that must never be lost before it expires, served fast to readers anywhere, while anonymous uploads attract spam and malware.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1How big can a paste be?
- 2How many new pastes and reads?
- 3Do pastes expire?
- 4Public or unlisted?
- 5Can a paste be edited?
- 6Who can delete a paste?
- 7Are there user accounts?
- 8Do we need syntax highlighting?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates
- 5minPart 3: API
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough