Design a TinyURL-like Short Link Service
Design a service that generates short URLs and redirects users to their original long URLs. The service should meet the following requirements:
- APIs: Provide APIs for creating a short link and for resolving (redirecting) a short link.
- Short Link Properties: Short links should be reasonably short (e.g., 6–10 characters) and unique.
- Collision Handling: The system must handle potential collisions in short link generation.
- TTL/Expiration: Support optional Time-To-Live (TTL) or expiration for short links.
- Scalability & Availability: The service must be scalable and highly available.
Discuss the data model, key generation strategy, storage and caching mechanisms (e.g., using Redis), collision handling, and the end-to-end redirect process.
AI interview prep
Core dilemma
Balancing the generation of globally unique, short, and human-readable identifiers with the need for high throughput, low latency redirects, and robust scalability under heavy load.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design a TinyURL-like Short Link Service
Design a service that generates short URLs and redirects users to their original long URLs. The service should meet the following requirements:
- APIs: Provide APIs for creating a short link and for resolving (redirecting) a short link.
- Short Link Properties: Short links should be reasonably short (e.g., 6–10 characters) and unique.
- Collision Handling: The system must handle potential collisions in short link generation.
- TTL/Expiration: Support optional Time-To-Live (TTL) or expiration for short links.
- Scalability & Availability: The service must be scalable and highly available.
Discuss the data model, key generation strategy, storage and caching mechanisms (e.g., using Redis), collision handling, and the end-to-end redirect process.