サンプル出力
27 10月 2026に作成
URL Shortener Architecture — Stress-Tested Revision
1. Stress-Test Findings
| Weak Point | Category | Failure or Cost Scenario | Mitigation |
|---|---|---|---|
| Central Snowflake-style ID Generator | SPOF | A single logical generator can block all automatic URL creation during failure, network partition, clock regression, or capacity exhaustion. Cross-region access also adds latency. | Remove the network ID Generator. Generate random 128-bit values in each Management Service instance, encode 48–64 random bits as an eight-character Base62 code, and claim the code through a conditional metadata-store write. Retry on collision. Custom aliases use the same conditional-write path. |
| Redis loss can cause a metadata-store stampede | Bottleneck | A cluster failure, mass eviction, deployment, or viral uncached link can shift up to 9,000 redirect reads/sec to the metadata store. Concurrent misses for the same code amplify traffic, invalidating capacity estimates based only on a 95% hit rate. | Add CDN and bounded in-process L1 caches, request coalescing, stale-if-error behavior, TTL jitter, hot-key isolation, and admission-controlled cache fills. Size and load-test the metadata store for full redirect traffic plus writes, not only normal cache misses. |
| Per-click Kafka, Flink, ClickHouse, and long-lived raw events | Cost | Analytics has high fixed operational cost and grows linearly with clicks. User-agent strings and event-level data inflate network, stream, storage, privacy, and query costs. Local buffering also risks event loss or disk exhaustion. | Emit compact schemas, parse or discard unnecessary fields at the edge, sample optional dimensions, aggregate at edge/service instances where exact event history is not required, and use a managed stream initially. Keep short hot-stream retention, batch compressed data to object storage, apply lifecycle policies, and retain only bounded aggregate detail. |
2. Assumptions and Requirements
- Peak traffic: **1