Loading...
Assume:
π Total β 20 TB β requires distributed storage
POST /shorten
Request:
{
"long_url": "https://example.com/abc",
"custom_alias": "optional",
"expiry": "optional"
}
Response:
{
"short_url": "https://sho.rt/xyz123"
}
GET /{short_code}
Response:
GET /analytics/{short_code}
Use:
Schema:
short_code (PK)
long_url
created_at
expiry
user_id
Use:
Key:
short_code β long_url
System divided into:
Use:
Properties:
ID β Base62 β short_code
123456789 β "8M0kX"
π Most requests never hit DB
hash(short_code)
Only 1 request hits DB
Others wait or reuse result
Track:
If threshold exceeded:
π Ensures:
Mitigation:
If cache miss:
Track:
Tools:
π Ensures: