Daily users: 1 million / day
Storage capacity: 1 url = 50 bytes average
1000 new urls a day = 50kb per day, 1.5 mb per month, lets say 100 mb per 5 years shall suffice
POST /alias [URL] -> {url: "http://url123", alias: "abcd"}
GET /alias/abcd -> {url: "http://url123", alias: "abcd"}
Only 3 components are required: Load balancer to distribute requests among instances, server instance, and a database.
No need to worry about concurrency because the server be stateless.
Write path: client sends url -> url is verified as well-formed -> alias generated (next unique integer to base64) -> added to db -> returned to client
Read path: client sends alias -> url is retrieved from cache or DB -> returned
Caching can be done on Local Cache, no need to add distributed cache
SQL will be a good solution because our data is a relation by nature (relates URL and its alias), very natural
table alias{
url: varchar
alias: varchar
}
No need for microservice architecture
1 monolith application is enough: 2 REST urls