← All parts

Capacity Planning

Design Pastebin · Part 5
Problem context

Design a service where a user submits a block of plain text — an error log, a configuration file, or a code snippet — and receives a short link (pb.example/a7x3kLm) that anyone can open to read that text later, optionally with an expiration time. Users can also propose a custom alias for their link if it is not already taken, and owners or moderators can delete a paste early.

In scope: creating a paste with an optional time-to-live (TTL) and optional custom alias, minting a short unique key, storing and serving the text body at high read volume, and expiring and reclaiming past-due pastes. Out of scope: user accounts and authentication, editing or versioning an existing paste, client-side syntax highlighting, and full-text search across pastes.

Scale and usage:

Capacity estimation here verifies three facts: write throughput is modest, read throughput dominates by two orders of magnitude, and a seven-character base-62 key space dwarfs multi-year paste volume. The numbers below follow from four baseline assumptions: 10 million new pastes created per day (illustrative). 100:1 read-to-write ratio (1 billion paste reads per day, illustrative). Press 6-char key (62⁶) or drag Base-62 key length from 7 chars down to 6 chars to see 10-year key-space usage jump from 1.04% to 64.26%, then click 10× scale (100M/day) to watch read QPS scale while write QPS stays near 1,157/s.

2.1 Writes are modest; reads dominate

One day has 24 × 3,600 = 86,400 seconds. Dividing 10 million daily writes across 86,400 seconds gives the average write rate: 10,000,000 ÷ 86,400 ≈ 116 writes/s Even with peak traffic several times the daily average (a few hundred writes per second), write volume sits well within the capacity of standard storage engines without write-buffering message queues. At a 100:1 read-to-write ratio, 10 million daily writes produce 1 billion daily reads: 116 × 100 = 11,600 reads/s Read throughput is the primary number to design around. Because pastes are immutable once created, a CDN and an in-memory cache absorb almost all of those 11,600 reads per second without touching the origin database.

2.2 Storage is bounded by expiry

What a strong answer sounds like

State the decision, connect it to a requirement, and name the tradeoff. Ask the interviewer for any product facts you need (users, usage, scale, targets) — they will answer. Keep the design focused on the workload.

Ready for the capacity planning interview?

The AI interviewer asks about this part of Design Pastebin. The interviewer guides you through topics one by one.