帮助设计与评估去中心化点对点系统的架构模式与关键机制
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "system-type-peer-to-peer" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/amplifier-bundle-systems-design/main/skills/system-type-peer-to-peer/SKILL.md 2. 保存为 ~/.claude/skills/system-type-peer-to-peer/SKILL.md 3. 装好后重载技能,告诉我可以用了
请为一个面向全球用户的 P2P 文件分发系统设计架构方案,重点说明网络拓扑、节点发现、NAT 穿透、数据分片与复制、容错机制,以及如何在没有中心服务器的情况下保证可用性与扩展性。
一份结构化架构方案,涵盖核心组件、通信流程、关键设计权衡与风险点。
请评估一个去中心化即时通信网络的设计是否合理,分析其身份与信任模型、消息路由、离线消息处理、一致性策略、抗审查能力,以及潜在的安全与性能问题,并给出改进建议。
一份评估报告,指出设计优缺点、主要风险及可执行的优化建议。
请为一个去中心化内容存储网络设计节点激励与信誉机制,说明如何鼓励节点贡献带宽与存储,如何防止女巫攻击、搭便车和恶意行为,并兼顾系统公平性与可持续性。
一套激励与信誉机制设计思路,包括规则、攻击防护措施及实施建议。
Patterns, failure modes, and anti-patterns for decentralized peer-to-peer systems.
When to use. Systems where any peer can hold any data and queries are exploratory — file sharing (early Gnutella), social feeds, informal mesh networks. When simplicity and resilience to churn matter more than lookup efficiency. When to avoid. Systems that need efficient key-based lookups. Large networks where flooding creates unacceptable bandwidth overhead. When query latency must be predictable. Key decisions. TTL (time-to-live) on forwarded messages, fanout degree (how many peers each node forwards to), duplicate message suppression, supernode election for partial structure.
When to use. Efficient key-value lookups in a decentralized network — content-addressable storage, distributed hash tables (Kademlia, Chord, Pastry). When you need O(log n) lookups instead of flooding. When to avoid. When keyword search or range queries are needed (DHTs only do exact key lookup). When the network has extremely high churn (DHT routing tables become stale faster than they can repair). Very small networks where the DHT overhead exceeds the benefit. Key decisions. Hash function and key space design, replication factor (k-bucket size in Kademlia), routing table refresh strategy, handling network partitions and merges, iterative vs recursive lookup.
When to use. When pure decentralization is a goal but some coordination is practical — BitTorrent (trackers + DHT), Skype's original architecture, many production P2P systems. Super-peers handle discovery and coordination; regular peers handle data transfer. When to avoid. When the super-peers become single points of failure that negate the decentralization benefit. When regulatory requirements demand fully decentralized operation. Key decisions. Super-peer election and rotation, fallback when super-peers fail, load balancing across super-peers, preventing super-peer capture or censorship, graceful degradation to pure P2P when coordination layer fails.
When to use. Local-area networks, IoT device clusters, real-time collaboration with small groups. When peers need direct, low-latency communication and the group size is bounded. When to avoid. Large networks — full mesh is O(n^2) connections. Wide-area networks where direct connections between all peers are impossible. Key decisions. Mesh density (full vs partial), relay selection for peers that can't connect directly, mesh topology maintenance, partition detection and healing.
When to use. Discovering your public IP and port mapping when behind a NAT. The first step in establishing direct peer connections. Works for most consumer NATs (cone NATs). When to avoid. Symmetric NATs, which assign different external ports per destination — STUN alone can't traverse these. Enterprise firewalls that block UDP entirely. The hard part. STUN servers must be publicly reachable. You need fallback for the ~8-15% of networks where STUN fails.
When to use. Fallback when direct connection is impossible — symmetric NATs, restrictive firewalls, corporate networks. All traffic relays through a TURN server. When to avoid. As a primary strategy — TURN servers are expensive (they relay all traffic) and add latency. Use only when STUN and hole punching fail. Key decisions. TURN server provisioning and cost (bandwidth is proportional to usage), geographic distribution for latency, credential rotation, capacity planning for peak concurrent relayed connections.
…
帮助设计可离线运行的边缘系统,处理同步、冲突恢复与弱网故障场景。
帮助设计与评估企业系统集成方案,覆盖遗留改造、网关、事件与失效模式。
用于按七步法系统审查架构设计,识别风险、权衡并产出改进建议。
用 Unix/Linux 设计哲学评估系统方案的可组合性、简洁性与关注点分离。
帮助用户设计或评估基于 Azure 的系统架构与运维方案
帮助设计和评估多租户SaaS的平台隔离、计量计费与稳定性方案
帮助用户设计与评估分布式系统的核心机制、权衡与故障处理方案
帮助设计与评估实时协作系统的连接、同步、冲突处理与故障模式
帮助设计或评估单页应用架构,涵盖路由、状态、性能与离线能力。
帮助你设计或评估Web服务架构、API模式、扩展性与可靠性问题。
帮助设计或评估命令行工具与开发者 SDK 的架构、兼容性和使用体验
帮助设计和评估事件驱动、消息驱动与异步工作流系统架构。