Menu
Medium #system-design·September 25, 2026

Scaling a URL Shortener for 100 Million Daily Requests

This article discusses the architectural considerations and solutions for building a highly scalable URL shortening service capable of handling 100 million daily accesses. It delves into critical components such as database design, caching strategies, and load balancing, highlighting trade-offs for performance and availability. The piece serves as a practical example for designing distributed systems under high load.

Read original on Medium #system-design

Introduction to Scalable URL Shorteners

Building a URL shortener might seem trivial, but scaling it to handle millions of requests daily presents significant system design challenges. The core functionality involves mapping a long URL to a short, unique identifier and redirecting users. Key considerations include low latency redirects, high availability, data consistency, and cost efficiency.

Key Architectural Components

  • Load Balancer: Distributes incoming traffic across multiple web servers to ensure high availability and prevent single points of failure.
  • Web Servers (APIs): Handle the 'shorten' and 'redirect' requests. These should be stateless for easier scaling.
  • Database: Stores the mapping between short and long URLs. Requires careful consideration for write and read performance.
  • Cache: Essential for reducing database load, especially for popular short URLs that are frequently accessed.
  • Queue/Message Broker: For asynchronous tasks like analytics logging or URL cleanup, decoupling the main request flow from non-critical operations.

Database Design and Scaling

For a URL shortener, the database must handle a high volume of reads for redirects and a moderate volume of writes for new short URLs. A common strategy is to use a NoSQL database like Cassandra or DynamoDB for its horizontal scalability, or a sharded relational database. Generating unique short codes efficiently and ensuring no collisions is critical. Strategies like base62 encoding or pre-generating codes can be employed.

💡

Short URL Generation

To generate unique short URLs without database lookups for every new entry, consider using a distributed unique ID generator or pre-generating a large pool of unique codes that worker nodes can consume. This avoids contention and improves write performance.

Caching Strategy

A cache (e.g., Redis, Memcached) is crucial. Most traffic to a URL shortener is redirecting existing short URLs. Caching these mappings drastically reduces the load on the database. A write-through or write-behind cache can ensure consistency for new short URLs, while a simple read-through cache is effective for existing ones. Eviction policies (LRU, LFU) should be considered to manage cache size.

url shortenerscalabilitycachingload balancerdatabase shardinghigh availabilitysystem architectureweb services

Comments

Loading comments...