Design a URL Shortener
Company: OpenAI
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design a URL shortening service similar to Bitly.
The system should:
- Accept a long URL and generate a short, unique alias.
- Redirect users from the short URL to the original long URL with very low latency.
- Support high read traffic and moderate write traffic.
- Optionally support expiration time, custom aliases, and basic click analytics.
- Handle reliability, abuse prevention, and scalability concerns.
Discuss requirements, APIs, data model, short-code generation strategy, storage choices, caching, scaling, fault tolerance, and major trade-offs.
Quick Answer: This question evaluates system design and distributed systems competencies, including scalability, availability, data modeling, API design, caching, storage choices, short-code generation strategies, reliability, abuse prevention, and operational trade-offs.