Capacity estimation
Storage Estimation
- Data Stored per URL Mapping: Assume each URL mapping stores the following information:
- Long URL: Approximately 100 characters.
- Short URL: Typically 8 characters.
- Metadata (e.g., created time, user ID, expiration time): Approximately 36 bytes.
- Total storage per entry can be estimated as about 144 bytes. To simplify calculations, let's round this up to 256 bytes for additional metadata or padding.
- Daily Storage:
- Assuming 1 million URL creations per day:
- [ 1,000,000 URL/day x 256 bytes/URL = 256 MB/day ]
- Yearly Storage:
- Over one year, this equates to approximately:
- [ 256 MB/day x 365 days/year = 93.44 GB/year ]
- With a 10x traffic spike, let's plan for:
- [ 93.44 GB/year x 10 = 934.4 GB/year ]
1,000,000 * 365 URLs to short per year = 365,000,000 urls
Bandwidth Estimation
- Redirection Requests: The bulk of the bandwidth usage comes from redirection requests.
- If each redirection involves roughly a 1KB request/response (including headers and actual URL data), and with 20 million redirections per day:
- [ 20,000,000 redirects/day x 1 KB/request = 20 GB/day ]
- Yearly Bandwidth:
- Over one year, bandwidth would be:
- [ 20 GB/day x 365 days/year = 7,300 GB/year = 7.3 TB/year ]
- Considering a 10x traffic spike:
- [ 7.3 TB/year x 10 = 73 TB/year ]