Design a service where users paste text, get a short link back, and anyone with the link can read the paste. Pastes can be up to 10 MB, most are read a handful of times, and a few go viral and are read millions of times.
Functional requirements
Create a paste and receive a short link
Read a paste by its link
Pastes expire after a chosen time
Optional syntax highlighting
Non-functional requirements
Reads p95 under 200 ms worldwide
Pastes are never lost before they expire
Viral pastes must not slow down everything else
Constraints and scale
5 million new pastes per day
10:1 read-to-write ratio, with heavy skew to a few pastes
Average paste 10 KB, maximum 10 MB
You will practise
Separate metadata from large blobs
Serve static content from a CDN
Scale a stateless API horizontally
Show 2 hints
Where should a 10 MB blob live: the database or somewhere cheaper?