Detailed Component Design
- URL Shortening algorithm
- Create as short as possible
- 62 = len([a-z][A-Z][0-9])
- 62^7 number of possible short urls
- Based62 approach or Traditional encryption CRC32
- CRC32 Approach
- Uses CRC32 to encrypt long_url to create a short
- Must handle collisions
- If there are collisions, add a fix suffix to make it unique
- Based62
- Each number is associated with a character
- 0-25: a-z
- 26-51: A-Z
- 52-62: 0-9
- Based62 current id until 0
- String will always be unique
- Con predictable to find the next iterate
- We can select CRC32 approach this can introduce a little more security
- Caching Strategy
- Uses a cache-aside strategy if there's a miss in the cache
- TTL Policy: ejects after 1-minute reduce cache bloat
- Cache Bloat: Cache needs to flush items ever minute
- Georeplicated so when changes happen in one node it should ripple to other nodes to stay in sync
- During updates of urls this should also be updated to indicate that the cache is not hosting stale data
How do you handle failure modes?
If there's a network outage, what path should we use to resolve it?
Should the load balancer immediately recognize the issue and redirect to clean path?
That also means the database needs to be georeplicated, especially if an entire area example WEST 2 is not accessible.