URL SHORTENER
REDIRECT
TOKEN EXPIRATION
API
Scalability
Reliability
Performance
Storage
Security
Application should be able to handle 20,000 read requests per seconds while managing 200 write requests per second
Amount of Read request per Day:
20000 * 86400(amount of seconds in the day) = 1,728,000,000 Read requests
Amount of Read request per Month would be around 51 Billions Read request
Amount of Write request per Day:
200 * 86400(amount of seconds in the day) = 17,280,000 Write requests
Amount of Request per Month would be around 510 Millions Read requests
POST /api/shorten : This is the API that accepts the original URL, service will generate a hash, this hash will be appended to the URL and the shortened URL will be returned.
GET /api/redirect/(short_url) : This is the API that will accept the short URL and redirect to the original URL
Since this data store has the core functionality of storing key value pairs with long URL associated with short URL for redirection. Since how read/write request ratio is 100:1 its better to focus on optimizing the read request. Hence this architecture doesn't require relational modal so we'll opt for a Nosql Solution implemented using DynamoDB or MongoDB
Client Request Initiation
API Gateway Processing
Load Balancer Routing
Server Processing
Data Handling & Processing
Database Replication
Redirection & Logging
Response Handling
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Single Point of Failure at the API ENDPOINT ,we should decentralize operation at this level, allowing API to be more scalable and be fault tolerant by using Horizontal scaling
Rate Limiting
Deploy multiple API Gateways across regions, use failover strategies like DNS routing.
Use message queues like RabbitMQ, Kafka, or AWS SQS to process tasks asynchronously.