A founder needs a URL shortener. Light traffic, simple job: take a long URL, hand back a short one. Wire up the basics and make it work.
Requirements
Functional
- ·User submits a long URL and gets back a short one
- ·User visits a short link and is redirected to the original URL
Non-functional
- ·~2 requests/sec average
- ·p99 latency ≤ 300ms
- ·99% availability
Constraints
- ·Budget: $6/hr or less
- ·90% of traffic is reads (resolving links), not writes (creating them)
Out of scope
- ·Custom aliases
- ·Link expiration
- ·Click analytics
TrafficRequests per second — the rate of incoming traffic this level throws at your system.
~2 r/s · read-heavy
90% reads · 10% writes
What fraction of requests are reads (fetches) vs writes (updates) — this decides which components sit on the hot path.Win conditions
- p99 latency99% of requests finish at or under this time — a stricter tail-latency bar than p95 that catches worst-case slowness.≤ 300ms
- availabilityThe share of legitimate requests that succeeded, out of everything sent your way. 99% still means 1 in 100 users saw an error.≥ 99%
- throughputHow many requests per second your system actually completed — not requested, completed.≥ 1.5 r/s
- error rateThe share of requests that failed outright: timeouts, drops, or capacity overload.≤ 5%
- costWhat your architecture costs to run per hour, based on the instances and components you've wired up.≤ $6/hr