1) Sometimes we would have restrictions on the tiny url. ex 41 bits
2) Allowed characters on the tiny url could be caps and smaller alphanumeric characters
SOLUTION
- When a long url is generated it is sent to the load balancer.
- Load balancer sends the request to the zookeeper instance
- We need to use token generation technique for generating tiny url
- When the requests per sec are in thousands we cannot rely on a single server generating the token.Token generation should be distributed across different servers
- To avoid collision the token generation should be distributed with specific range to each server
- When the token are exhausted we need to have new set of of tokens and range also should be changed
- For security reason we should also ad some randomness in the generated url
- Once the token is generated it would be stored in the cache (redis) and database server
- All new request would be taken from the cache. If it is not able to find then it would be fetched from the database
- For specific regions cached tokens would be available in the local CDNS
No comments:
Post a Comment