URL redirecting deep dive
Last updated
Last updated
The picture below shows the detailed design of the URL redirecting. As there are more reads than writes, <shortURL, longURL> mapping is stored in a cache to improve performance.
The flow of URL redirecting is summarized as follows:
A user clicks a short URL link: https://tinyurl.com/zn9edcu
The load balancer forwards the request to web servers.
If a shortURL is already in the cache, return the longURL directly.
If a shortURL is not in the cache, fetch the longURL from the database. If it is not in the database, it is likely a user entered an invalid shortURL.
The longURL is returned to the user.