Walk me through how you'd design a URL shortener like Bitly that handles a few thousand redirects per second.

system-design · Mid level · software-engineering

What the interviewer is really asking

Assesses whether the candidate can take a deceptively simple prompt and reason through key generation, the read-heavy access pattern, and storage choices — not whether they memorized a canonical answer.

What to say

What to avoid

Example answers

Strong: I'd confirm scale first — say 10M new links/day and ~1B redirects/day, so it's read-dominated. I'd generate 7-char base62 keys from a distributed counter (range-allocated per app server) to guarantee uniqueness without a per-write collision check. Redirects hit a Redis cache-aside layer in front of DynamoDB; on miss I read the KV store and backfill. I'd use 302 so I can change destinations and capture click analytics, and push the analytics event onto a queue so it never blocks the redirect.

Weak: I'd hash the long URL with MD5 and take the first few characters as the short code, store it in a SQL table, and redirect.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.