call(back)

Design a URL Shortener

Design a URL-shortening service like bit.ly: generating short codes, storing mappings, and redirecting with low latency. Cover capacity estimation, the read/write ratio, hot links, and how you would add per-link analytics without slowing down redirects.

Hints

Hint 1

Base62 over an auto-incrementing id is simple — think about what it leaks and when you need random codes instead.

Hint 2

Redirects are overwhelmingly read-heavy. Work out where caches and CDNs fit before sharding anything.

Asked at