Goal: Convert long URLs into short unique codes, and redirect users when they visit the short link.
Key Requirements
Functional:
Shorten a long URL → return a short URL.
Redirect short URL → original long URL.
Handle high read/write traffic.
Non-functional:
High availability.
Scalability (millions of URLs).
Low latency.
Architecture Components
API Gateway → handles requests (
POST /shorten,GET /{shortCode}).Application Service → generates short codes, stores mappings.
Database → stores mapping of
shortCode → longURL.Cache (Redis) → fast lookups for popular URLs.
Load Balancer → distributes traffic across servers.
Flow
User sends long URL → API Gateway.
Service generates short code (e.g., base62 encoding).
Store mapping in DB + cache.
Return short URL (
tinyurl.com/abc123).On access, lookup short code → redirect to original URL.
👉 This is the big picture: what modules exist, how they interact.
No comments:
Post a Comment