Endpoitns:
From previous calculation we found out 5unique combinations can satisfy our requirements.
Our short URL database can have the following columns
id, shortUrl(varchar(5)), longUrl(varchar), createDatetime(datetime), updateDatetime(datetime), user(userId)
For user database
id, username(varchar), password(varchar)
Load balancer: to distribute requests from client
service: distribute services that handle all HTTP requests
Cache: for get requests, first check cache, if short URL cannot be found in short URL then check database
Database: distributed database that handles read and write
redirect url 301 vs 302, 301 is permanent redirect and 302 is temporary redirect. 301 is used here because we don't need to keep track of user's requests afterwards.
Using zookeeper, where a centralized system arranges the unique key distribution.