115,000 Read QPS / 1,150 Write QPS
Sustained peak request volume during high-traffic events.
Design a globally distributed TinyURL service with 100:1 read-heavy traffic and sub-10ms redirects.
Target production parameters expected in a senior or staff interview round.
Sustained peak request volume during high-traffic events.
Daily active users generating read and write operations.
Projected data ingestion and replication storage capacity.
Strict end-to-end percentile latency SLA constraint.
Establish clear problem boundaries before proposing architectural components.
Step-by-step arithmetic conversions for QPS, storage, and bandwidth.
| Dimension | Calculation Formula | Estimated Result |
|---|---|---|
| Write & Read Throughput | 100M new URLs/month = ~40 write QPS. 100:1 read ratio = ~4,000 read QPS (Peak = ~115k QPS) | ~1,150 Peak Write QPS / ~115,000 Peak Read QPS |
| 5-Year Storage Capacity | 100M URLs/month × 12 months × 5 years × 500 bytes/record | ~30 Billion URLs = ~15 Terabytes total persistence |
| Cache Memory Size | 20% hot URLs account for 80% read traffic. 115k QPS × 86,400s × 0.2 × 500B | ~100 GB RAM Redis Cache Cluster |
How requests navigate ingress gateways, application logic, caching, and persistence.
Pre-generates Base62 7-character keys into memory buffers, avoiding on-the-fly hash collisions.
Handles short code lookups from cache, returning immediate HTTP 301 redirects.
Stores key-to-URL mappings sharded by the first 2 characters of the short key.
Entity models, indexing, and primary key partitioning.
Partitioned by short_key hash with secondary index on user_id for analytics.
How to defend engineering compromises when challenged by interviewers.
Rationale: Selected 302 for commercial analytics and link revocation, with edge CDN caching to balance latency.
Rationale: KGS eliminates duplicate hash retries and guarantees O(1) instantaneous write latency.
Key interview questions and conceptual defenses.
Base62 uses [a-z, A-Z, 0-9]. A 7-character string provides 62^7 = 3.5 trillion unique URLs, easily sufficient for decades of scale.