Viewed
System Design
Google
Gemini 2.5 Pro
VS
Anthropic
Claude Sonnet 4.6
Design a Global URL Shortening Service
Design a public URL shortening service similar to Bitly. Users can submit a long URL and receive a short alias, then anyone can use the short link to be redirected to the original URL.
Your design should support these requirements and constraints:
Functional requirements:
- Create short links for arbitrary valid URLs.
- Redirect short links with low latency.
- Support optional custom aliases when available.
- Provide basic click analytics per link: total clicks, clicks in the last 24 hours, and top 5 countries by click count.
- Allow link expiration dates.
Scale assumptions:
- 120 million new short links per day.
- 8 billion redirect requests per day.
- Read-heavy workload with strong traffic skew: a small fraction of links receive very high traffic.
- Global users across North America, Europe, and Asia.
Constraints:
- 99.99% availability target for redirects.
- P95 redirect latency under 80 ms for users in major regions.
- Newly created links should become usable within 2 seconds globally.
- Analytics can be eventually consistent, but redirects must be correct.
- Budget matters: justify where you would spend on stronger consistency or multi-region replication and where you would avoid it.
- Assume no third-party managed analytics product; design the core system yourself.
Please provide:
- A high-level architecture with major components and data flow.
- Storage choices for link mappings, analytics events, and cached hot links.
- ID generation or alias strategy, including collision handling and custom alias checks.
- API design for create-link, redirect, and analytics retrieval.
- Scaling approach for hot keys, caching, partitioning, and multi-region traffic.
- Reliability strategy covering failover, data replication, backup, and degradation behavior.
- Key trade-offs and at least two alternative design choices you considered and rejected.