Thanks for reading systemdesign.one newsletter. If you're not yet subscribed, let me help you with that:
The following is the back-of-the-envelope calculation for a URL shortener.
Traffic
The URL shortener is a read-heavy service. The Daily Active Users (DAU) for writes is 100 million. The Query Per Second (QPS) of reads is approximately 100 thousand.
Storage
The shortened URL persists by default for 5 years in the data store. Each character size is assumed to be 1 byte. A URL record is approximately 2.5 KB in size. Set the replication factor of the storage to a value of at least three for improved durability and disaster recovery.
Bandwidth
Ingress is the network traffic that enters the server (client requests).
Egress is the network traffic that exits the servers (server responses).
Memory
The URL redirection traffic (egress) is cached to improve the latency. Following the 80/20 rule, 80% of egress is served by 20% of URL data stored on the cache servers. The remaining 20% of the egress is served by the data store to improve the latency. A Time-to-live (TTL) of 1 day is reasonable.
Find out more by reading the full article on my website systemdesign.one!
Why do we consider 300 days instead of 365 days while calculating storage?