• The design lacks a clear high-level overview. It's not clear how the different components interact with each other.
• The design does not address key requirements such as high availability, low redirect latency, and horizontal scalability.
• The detailed component design is lacking in depth and does not address several key issues such as handling of cache misses, generator outage or split-brain scenarios.
POST -> https://tinyurl.com
Request Body: Original Url
Response: Shortened URL
GET -> https://tinyurl.com/shortnedurl -> redirect to original url
I have created the high level diagram as you see in Excalidraw. Where Client Sends 2 requests post request for creating a new shorten url and then get request for redirection of shorten url with original url. Now Client sends request , the load balancer uses Round Robin Algorithm or Weighted Round Robin if the resources of the server are different. now server reads the request. For Post request it gonna create a new record mapping original url with shorten url. where we are using Cassandra for High Availability. Now For Get Request , the server calls the redis with key as the shorten url. if redis doesn't contains that key, means the key is expired then it will get it from the database. Where redis stores the url in cache for max 5 to 15 mins. If database doesn't had the record . then server will show 404 NOT FOUND ERROR. When Cache is missed it will check in Database. As we are using Non SQL Database Cassandra, it scales Horizontally with out any issue. so even if some nodes failed remaining nodes serve the request with out any issue. To Overcome generator outrage, we are going maintain multiple availability zones. Instead of single. Like we are going to maintain multiple apache cassandra's in different availability zones and Multiple regions.Split brain scenario won't happen in this scenario , as we are using Apache Cassandra, where there will be no leader ever node is connected with all other nodes.
We are going to use the Loadbalancer to serve request evenly across all the servers. Using distributed Redis Cache for getting the actual Url for the shorten url. And we are using Apache Cassandra for more Availability by specifying consistency to Quoram.