Design a Pastebin Text Sharing Service
Let a user create a text paste and later fetch it by a generated short ID until it expires.
Problem statement
Design a Pastebin-style text sharing service.
For this exercise, assume a user creates a text paste and later fetches it by a generated short ID. For this exercise, assume pastes expire after 24 hours and reads after expiry return not found. For this exercise, assume 2,000 writes and 20,000 reads per second with p99 read under 50 ms.
For this exercise, assume accounts, comments, syntax highlighting, and private encrypted vaults are out of scope. For this exercise, assume a focused follow-up will ask how short IDs stay unique under concurrent creates.
For this exercise, assume the read cache is far smaller than the set of live pastes, so it must choose which pastes to keep.
What to build
- A user can create a text paste and receive a generated short ID.
- Anyone with the short ID can fetch the paste body while it is still valid.
- After 24 hours the paste is no longer readable and fetches return not found.
At scale
- For this exercise, assume 2,000 writes per second.
- For this exercise, assume 20,000 reads per second.
- For this exercise, target p99 read latency under 50 ms.
- For this exercise, pastes expire after 24 hours, so storage and cache must not serve expired bodies.
- For this exercise, assume an average paste is about 10 KB and each read-cache node has about 64 GB of memory, far less than the pastes alive at once.