Design - URL Shortener

FUNCTIONAL REQUIREMENTS - Get short url Redirect to long url NON-FUNCTIONAL REQUIREMENTS - Low latency High Availability API ENDPOINTS - POST v1/data/shorten GET v1/{shortUrl} How to shorten the URL? Let us consider the shortened URL consists of character (a-z), (A-Z) and (0-9). So, the number of characters present are 26+26+10 = 62. Let's say our URL shortener can generate 11600 urls/second. So, it can generate 1160*3600*24 = 100 million url's per day. Let's say we want to store the URL's for 10 years. Therefore, 100 million * 365 * 10 = 365 billion records. So, from this estimation we can infer the max length of the shortened URL - 62^⒩ >= 365 billion . So n comes out to be 7. Therefore, a url of length 7 is more than enough to store 365 billion records. DESIGN - The main problem we face here is, how to generate ID's. One way is to use auto increment feature of RDBMS but that puts to much load on the system if the traffic is high. We also cannot genera...