---
title: "[System Design] Global URL Shortener: 10B QPS Redirects with 99.999% Availability"
canonical_url: "https://airsota.com/2026/10/24/system-design-scalable-url-shortener-2026-10-24-en/"
date_published: "2026-10-24T16:01:12-07:00"
date_modified: "2026-10-24T16:01:12-07:00"
language: "en-US"
alternate_language_url: "https://airsota.com/2026/10/24/system-design-scalable-url-shortener-2026-10-24-zh/"
categories: ["TalentMe (AI 学习与算法架构)", "💻 大厂系统设计与架构 (System Design Pulse)"]
tags: ["architecture", "Distributed Systems", "FAANG Interview", "High Availability", "system-design", "talentme"]
summary: "Decoupling write-path ID generation via Snowflake from read-path 301/302 analytics using a multi-tier Redis/CDN cache hierarchy to sustain 100:1 read/write asymmetry."
publisher: "AirSOTA (https://airsota.com)"
---

# [System Design] Global URL Shortener: 10B QPS Redirects with 99.999% Availability

> **Executive Summary**: Decoupling write-path ID generation via Snowflake from read-path 301/302 analytics using a multi-tier Redis/CDN cache hierarchy to sustain 100:1 read/write asymmetry.

ARCH CHALLENGE

Global Scalable URL Shortener

    TARGET SCALE

10B redirects/day (~115k QPS avg, 500k QPS peak), 100M writes/day, P99 < 50ms, 99.999% SLA

    TARGET LEVEL

L5 / L6 (Senior / Staff)

    CORE PILLARS

High Availability & Consistency

    

### 🧮 Back-of-the-Envelope Capacity Estimations

    
        Traffic QPS

Reads: 10B/day = 115,740 QPS avg. Peak (10x): ~1.1M QPS. Writes: 100M/day = 1,157 QPS avg.

        Storage Growth

100M links/day * 365 = 36.5B/year. 100 bytes/record = 3.65TB/year. 5-year retention = ~18TB raw, 54TB with 3x replication.

        Memory / Cache (80/20)

80/20 rule: 80% of traffic hits 20% of URLs. 20% of 10B = 2B hot URLs. 100 bytes/entry = 200GB. Allocate 512GB Redis cluster for L1 cache.

        Bandwidth In/Out

Ingress: 1.1M QPS * 1KB = 1.1 GB/s. Egress: 1.1M QPS * 100B (redirect header) = 110 MB/s. CDN offloads 90% of egress.

    

    

### 📐 High-Level Architecture Topology

    
flowchart TD
  A[Client] --> B[CDN Edge]
  B -->|Cache Hit| C[301/302 Redirect]
  B -->|Cache Miss| D[API Gateway]
  D --> E[Shortener Service]
  E --> F[Redis Cluster]
  E --> G[Snowflake ID Gen]
  E --> H[PostgreSQL Sharded]
  F -->|Miss| H
  H --> I[Analytics Pipeline]
    

### 🏛️ Architecture Deep Dive & Component Topology

### Ingestion & ID Generation

Writes are decoupled from reads. A centralized Snowflake ID generator (64-bit: 1-bit sign, 41-bit timestamp, 10-bit machine ID, 12-bit sequence) ensures global uniqueness without coordination. Base62 encoding converts the 64-bit ID into a 10-11 character string. Writes go to a single-writer PostgreSQL shard to maintain consistency, then asynchronously publish to Kafka for analytics.

### Read Path & Caching

Reads are served by a CDN edge layer. The CDN caches 301 (permanent) redirects aggressively (TTL: 30 days) and 302 (temporary) redirects briefly (TTL: 5 min) to preserve analytics accuracy. On cache miss, requests hit the API Gateway, which queries a multi-tier Redis cluster. L1 Redis (hot keys, 512GB) handles 80% of traffic. L2 Redis (warm keys) handles 15%. Only 5% of requests hit PostgreSQL. Bloom filters are used in the Redis layer to quickly reject non-existent URLs, preventing database lookups for invalid keys.

### Partitioning & Sharding

PostgreSQL is sharded by the first 2 characters of the Base62 ID (1,849 shards) to distribute load evenly. Each shard is a primary-replica pair. Reads are routed to replicas, writes to the primary. A consistent hashing ring ensures that data locality is maintained during shard scaling.

### 💾 Data Models (DDL/Schemas) & API Contracts

### SQL DDL

```
CREATE TABLE urls (
  short_code VARCHAR(11) PRIMARY KEY,
  long_url TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT NOW(),
  expires_at TIMESTAMP,
  click_count BIGINT DEFAULT 0,
  region VARCHAR(10)
) PARTITION BY LIST (LEFT(short_code, 2));
```

### REST Endpoints

```
POST /v1/shorten
  Body: {"url": "https://example.com/long/path"}
  Response: {"short_url": "https://tinyurl.com/abc123"}

GET /{short_code}
  Response: 301/302 Redirect to long_url

GET /v1/stats/{short_code}
  Response: {"clicks": 12345, "first_click": "2023-01-01"}
```

### 🛡️ Extreme Failure Scenarios, Stampede Defense & Self-Healing

### Split-Brain & Consistency

In a multi-region setup, split-brain can occur if a region becomes isolated. Mitigation: Use a quorum-based consensus protocol (Raft) for the Snowflake ID generator to ensure no duplicate IDs are issued. For data, use a primary-replica model with a single writer per shard. If a region fails, traffic is rerouted to the healthy region via DNS failover. Data is replicated asynchronously, so there is a risk of data loss (RPO: 1 min). For critical use cases, synchronous replication can be enabled, but this increases latency.

### Cache Stampede

When a hot key expires, thousands of requests may hit the database simultaneously. Mitigation: Use a mutex lock in Redis to ensure only one request fetches the data from the database, while others wait. Alternatively, use a probabilistic early expiration (PEXPIRE) to stagger cache invalidations. Bloom filters also help by quickly rejecting non-existent keys, reducing the load on the database.

### Disaster Recovery

Multi-region active-active deployment with DNS-based traffic routing. Each region has its own Snowflake ID generator, Redis cluster, and PostgreSQL shards. Data is replicated across regions using Kafka Connect. In the event of a regional failure, DNS is updated to route traffic to the healthy region. RTO: 5 min, RPO: 1 min. Regular chaos engineering tests (e.g., killing a region) are performed to validate the failover process.

    

### 🎯 Interview Evaluation Rubric: L4/Senior vs L6/Staff Architect

    
        
            L4 / Senior Engineer Baseline

            Proposes a single-region architecture with a simple Redis cache and PostgreSQL. Uses a UUID or auto-increment ID. Does not consider multi-region failover, cache stampede, or the difference between 301 and 302 redirects. Basic load balancing with Nginx.

        

        
            L6 / Staff Architect Differentiators

            Designs a multi-region active-active architecture with a Snowflake ID generator for global uniqueness. Uses a multi-tier Redis cache with Bloom filters to reduce database load. Differentiates between 301 and 302 redirects for CDN caching. Implements a quorum-based consensus protocol for the ID generator to prevent split-brain. Uses Kafka for asynchronous analytics and data replication. Regular chaos engineering tests to validate failover. Cost optimization by using spot instances for non-critical workloads.

        

    

📺 YOUTUBE MASTERCLASS🎬 Visual Teardown: System Design Interview Question: Design URL Shortener

[
            Watch on YouTube ↗
        ](https://www.youtube.com/watch?v=16d35un5a9Q)

💡 Key Study Takeaway:ByteByteGo high-frequency FAANG system design teardown of location-based services exploring GeoHash vs QuadTree.

🛍️ Recommended Gear for This Topic🔥 4 Curated Picks

[](https://www.amazon.com/s?k=Anker+Prime+240W+GaN+Desktop+Charger&tag=airsota2024-20)⚡ 240W Fast Charge[Anker Prime 240W GaN Desktop Charging Station (4 Ports)](https://www.amazon.com/s?k=Anker+Prime+240W+GaN+Desktop+Charger&tag=airsota2024-20)$140 ~ $180[View ↗](https://www.amazon.com/s?k=Anker+Prime+240W+GaN+Desktop+Charger&tag=airsota2024-20)

[](https://www.amazon.com/s?k=Designing+Data+Intensive+Applications+Martin+Kleppmann&tag=airsota2024-20)📖 Must-Read[Designing Data-Intensive Applications (DDIA) by Martin Kleppmann](https://www.amazon.com/s?k=Designing+Data+Intensive+Applications+Martin+Kleppmann&tag=airsota2024-20)$35 ~ $45[View ↗](https://www.amazon.com/s?k=Designing+Data+Intensive+Applications+Martin+Kleppmann&tag=airsota2024-20)

[](https://www.amazon.com/s?k=System+Design+Interview+Insiders+Guide+Alex+Xu&tag=airsota2024-20)🎯 FAANG Prep[System Design Interview – An Insider's Guide by Alex Xu (Vol 1 & 2)](https://www.amazon.com/s?k=System+Design+Interview+Insiders+Guide+Alex+Xu&tag=airsota2024-20)$36 ~ $42[View ↗](https://www.amazon.com/s?k=System+Design+Interview+Insiders+Guide+Alex+Xu&tag=airsota2024-20)

[](https://www.amazon.com/s?k=Logitech+MX+Master+3S+Wireless+Mouse&tag=airsota2024-20)⚡ Ergonomic Gear[Logitech MX Master 3S Wireless Performance Ergonomic Mouse](https://www.amazon.com/s?k=Logitech+MX+Master+3S+Wireless+Mouse&tag=airsota2024-20)$90 ~ $99[View ↗](https://www.amazon.com/s?k=Logitech+MX+Master+3S+Wireless+Mouse&tag=airsota2024-20)

⚖️ AirSOTA is a participant in the Amazon Services LLC Associates Program. As an Amazon Associate, we earn from qualifying purchases at no extra cost to you.

    🧭 Master FAANG System Design on TalentMe

    Access 69+ production-grade algorithm breakdowns, distributed architecture simulations, and mock interviews.

    [
        🚀 Launch TalentMe Architecture Workbench →
    ](https://talentme.airsota.com)

---
*Source: [AirSOTA Knowledge Matrix](https://airsota.com/2026/10/24/system-design-scalable-url-shortener-2026-10-24-en/) · Complete Index: [llms.txt](https://airsota.com/llms.txt)*
