The Real Fullstack

Design a URL Shortener

Redirects must be instant and codes must never collide. Where does each requirement live in your architecture?

工程师12 分钟架构构建器
redispostgresqlkafkaload-balancer

此挑战尚未翻译为简体中文,你正在阅读英文版本。

任务:Assemble an architecture that satisfies every requirement: entry through a load balancer, durable storage, cached hot reads, collision-free key generation, asynchronous analytics, no public database — within budget.背景 · 学习目标 ▾

Snip.example, a fictional link service, expects about 100 redirects for every new link. Marketing wants click analytics, but analytics must never slow down a redirect. The infrastructure budget is 20 units.

任务: Assemble an architecture that satisfies every requirement: entry through a load balancer, durable storage, cached hot reads, collision-free key generation, asynchronous analytics, no public database — within budget.

学习目标

  • Translate requirements into components and connections.
  • Separate the read path from the write path.
  • Move non-critical work off the request path with a queue.
模拟模拟数据
Clients → Load balancerClients → Redirect serviceClients → Links DBLoad balancer → Redirect serviceRedirect service → RedisRedirect service → Links DBRedirect service → Key generatorRedirect service → Click queueClick queue → Analytics workerAnalytics worker → Analytics storeRedirect service → Analytics storeClients → CDNCDN → Load balancerClientsCDNLoad balancerRedirect serviceRedisLinks DBKey generatorClick queueAnalytics workerAnalytics store

选择组件和连接。键盘操作:使用示意图下方的列表。

运行模拟

运行模拟以查看输出。

简化说明

Requirements are checked structurally (paths and forbidden links), and costs are abstract units. Real designs need capacity estimates per component. 教学模型——数字用于说明行为,并非基准测试。

概念

相关挑战

参考资料