Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
at the heart of this problem, we need 2 components.
for now, let's assume that we have the URL incrementor service. we need a key value store (like redis) to store the short-form urls. but also for availability, we will need to have copies of this db for redundancy and high availability.
ok i designed something.
for url shortener: i use a hashing mechanism so that the urls are not easily predictable. the shortener adds sort of a salt to the incoming urls so that the users cannot guess their final urls but also the generation is predictable (on our side) and reuses the same address for the same url.
i assume there is not a big chance for a hash colision but in case two different urls hash to the same thing, i propose the shortener to have a list of multiple salts so that if the first one leads to a colision, use the second, then the third, ... until one salt yield either a shortened url for the incoming url or if there is no corresponding url mapped to it.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.