#01EasyCore Distributed Systems

Design a URL Shortening service like TinyURL

ASKED IN INTERVIEWS AT:GoogleMetaAmazonMicrosoft

EXECUTIVE SUMMARY & PROBLEM STATEMENT

Design a high-throughput, low-latency URL shortening service that generates compact 7-character aliases for long URLs with high read-to-write ratios and collision-free key generation.

SCALE ESTIMATION & TRAFFIC ENVELOPE

DAILY ACTIVE USERS / TPS100 Million requests/day
READ / WRITE TRAFFIC RATIO100:1 (Read-heavy)
5-YEAR STORAGE CAPACITY~15 TB over 5 years (Base62 7 chars ~ 3.5 trillion URLs)

FUNCTIONAL REQUIREMENTS

  • [1]Generate short alias for given URL
  • [2]Redirect HTTP 301/302 to original URL
  • [3]Custom short URLs and optional expiration time

NON-FUNCTIONAL REQUIREMENTS

  • •Highly available (99.99%)
  • •Sub-10ms redirection latency
  • •Unpredictable / non-sequential short keys

CORE ARCHITECTURAL COMPONENTS

L4/L7 Load Balancers
Stateless API Gateways
Offline Key Generation Service (KGS)
Redis LRU Cache
Replicated NoSQL / PostgreSQL Store

DATA SCHEMA & PERSISTENCE

Mapping Table: hash_pk (PK), original_url, user_id, created_at, expires_at

DISTRIBUTED TRADE-OFFS & FAILURE MODES

  • ⟡301 Permanent Redirect (faster, cached in browser) vs 302 Temporary Redirect (allows telemetry / click analytics).