Posts

Showing posts with the label system design

URL Shortener System Design

Image
STEP 1  Functional Req. Given a Long URL, generate a unique short URL. Given a short URL, redirect to a long URL Customized URL,(User should be able to pick a custom short link) TTL (User should be able to specify the expiration time) Non-Functional Req. The system should be highly available. With min latency Non-predictable Analytics Design Constraint Generated per second Length of the short URL,  Let’s start with 7 Char set in the short URL; A-Z, a-z, 0-9 STEP - 2 Microservice Design Decision URL Shortener Microservices All requirements can handle the same team A single microservice - A depth-oriented problem STEP - 3 Drawing logic architecture STEP - 4A  TIERS Default we can multiple every tier 3X  App server tier, In-memory Tier, Storage Tier Data Model Short URL/unique ID, Long URL, TTL, creation time K: Short URL/unique id,  V: Rest of the stuff APIs create(Long URL) -> create(V) read(short URL) -> read(K) Similar to CRUD APIs create (K,V), read(K), ...