1) Accept input URL and return shortened URL
2)Store short URL to long URL mapping in efficient hash store
3)Duplication and collisions should never be happen
1)low latency, user should not notice delay
2)Should scale really well to millions of users
3)Should be cost effective
5)Highlight scalable and consistent
Estimate the scale of the system you are going to design...
100 million URL requests a day
front end where to enter log URL and it should return short URL in output box
Highly efficient hash store and also handles hash collisions
1) loadbalancer
2) api gateway
3) Hash store DB
4) Analytics engine
5)CDN to maintain local cash
User enters URL in front end, goes to load balancer appropriate api end point passes it to hash DB where long URL is converted to short form and store , key is short URL, value is long URL.
Hashstore should fast retrieval and collision should be handled,
latency should milli seconds
Underused records should be purged
Redis cache for Hash DB
NGNIX for webserver/API
if some URLs are heavily used and load the system, need to be fault tolerant and highly available, horizontal and vertical auto scaling should be supported
Use AI and ML for recommendation for capacity planing and which ones need to be stored in CDN