Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- Low-latency:
- Application deployed in continents
- A geo load-balancer
- A load-balancer in continental regions, to handle internal replicas
- Scalability, Availability:
- The load balancers's take care of this
- Reliability:
- Geo load-balancer's handle application run-time reliability
- For database:
- Master (with replicas) to route to the location of database
- Continental database, with replication in nearst continent database
API Design
- User management apis
- registration
- authentication
- user edit related apis
- user delete
- Url shortening apis
- public url shortening
- for registered users, to use custom defined domain name
- Custom domain management apis
- CRUD to manage user custom domains
- Shortened url management for user
- CRUD to manage
- Url redirector apis
High-Level Design
- Application runtime
- Geo load balancer
- Regional load balancer
- Application runtime
- Application database
- Master - stores geological data
- Continental Database - continental info with replica of nearst
- Low level master - handles replication to ensure availability
- Actual database
Workflow:
- Request goes to geo load balancer
- It determines which regional load balancer to invoke
- region load balancer decides an application runtime instance to serve the request
- the db request goes to geo master
- geo master finds the location of the actual data, and redirects to the continental database
- eventually reaches the actual database
- cache at continental level
Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.