High-Throughput URL Shortener
URL shortening engine live at trimto.me — Go + PostgreSQL + Redis, with singleflight cache-aside, Lua rate limiting, and the benchmarks committed.
- Singleflight Request CoalescingA thousand simultaneous requests for the same expired link become one database query instead of a thousand. Measured at +35% throughput versus coalescing off.
- Fail-Open Under Cache OutageIf Redis disappears the redirect path falls back to PostgreSQL rather than returning 500s. Benchmarked with Redis killed mid-run.
- Covering Index for Heap-Free ReadsThe lookup index carries the destination in its leaf pages, so a redirect resolves without touching the table — with a documented caveat about the click counter.
- Singleflight A/B
- +35% throughput5,871 vs 4,351 req/s; p99 448ms → 364ms (controlled, same build)
- Stampede Guard
- 1 DB queryPer 1,000 concurrent misses on the same cold key
- 60s Soak
- 195,357 reqs3,253 req/s sustained, p99 139ms, zero errors
- Binary Footprint
- 12 MBCGO-free static scratch container