Design a high-scale URL shortener
Company: Microsoft
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design a URL shortening service.
## Core APIs / Features
- **Create short URL**: accept a long URL and return a short code / short URL.
- **Redirect**: given a short code, redirect to the original long URL.
- Optional:
- **Expiry** (TTL) for short links
- **Analytics** (click counts, time series, referrer, geo/device, etc.)
- **Admin / management** (list links, disable/delete, etc.)
## Scale assumptions
- ~**1M creates/day**
- ~**1B redirects/day** (read-heavy)
## Follow-up requirements
1. **Multi-region / global low latency**: how do you serve redirects quickly worldwide (geo routing, load balancing, caching strategy, consistency trade-offs)?
2. **Write spike durability**: if create traffic spikes from ~300–500 QPS to **1000 QPS**, how do you **guarantee every create request is processed without dropping** (e.g., queue/worker, retries, DLQ, idempotency, backpressure)?
Quick Answer: This question evaluates a candidate's ability to design scalable, high-throughput distributed systems with emphasis on URL mapping, storage and indexing, caching and geo-routing for low latency, capacity planning for heavy read/write ratios, and durability under write spikes and analytics requirements.