Here is a popular design available in internet of Tiny URL application:
The application is loadbalanced with the help of a zookeeper, where each server is assigned a counter range registerd with zookeeper.
Each application is having an locally available counter, which increments on every write request.
There is Cache available which(probably) gets updated with each write request.
Gaps in my understanding:
For every write request, we dont check if a tiny url exists in the db for the large URL..so we keep on inserting all write requests(even though a tiny url already exist for that particular large URL). Is that correct? If so then would there be a clean up activity(removing redundant duplicate tiny urls for same large URL) at some intentional downtime of application in the day?
What is the point of scaling...if for 1 million(or more) range of counter value there is just one server handling the request. Wouldn't there be a problem..? say for example there is large scale writing operation, would there be a vertical scaling to avoid slowness?
Kindly correct if there if I have got anything wrong here.