Design A URL Shortener
Company: Uber
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design a URL shortening service.
Users submit a long URL and receive a short URL. When someone visits the short URL, the service redirects them to the original long URL.
Discuss:
- Functional requirements, such as creating short links, redirecting users, optional custom aliases, expiration, and basic analytics.
- Non-functional requirements, such as low redirect latency, high availability, scalability, durability, and abuse prevention.
- API design.
- Data model and storage choices.
- Short-code generation strategy.
- Caching and database scaling.
- Redirect flow and analytics collection.
- Tradeoffs such as `301` vs `302` redirects and random vs sequential short codes.
Quick Answer: This question evaluates skills in large-scale system design, covering distributed systems, API design, data modeling and storage, caching, short-code generation, redirect flows, analytics collection, scalability, availability, durability, and abuse prevention.