Yearly Pay yearly and get 2 months free on every paid plan. See plans
登录 免费开始

架构草案

输入
系统需求
a URL shortener that must handle 10k requests/sec with analytics
示例输出 生成于 27 十月 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
使用这个 架构草案 表单会预填此示例的输入,可随意修改。