Prompts-MCP 686 skills · ai / design / design-pattern / framework / fundamentals / habit / lang / tech-selection /mcp/sse
fundamentals fundamentals/distributed-theory/index.md medium

fundamentals-distributed-theory-index

分布式理论选型四件事 — CAP 取舍(CP/AP)/ 分布式事务方案选型 / 幂等设计 / 分布式 ID 选型。Use when 选注册中心一致性模型 / 选分布式事务方案 / 设计幂等 / 选分布式 ID 算法时。

子项索引

子项 一句话
distributed-cap-tradeoff skill CAP 取舍决策 — 分布式系统 P(分区容忍)必选,真正的取舍是网络分区时选 C(一致性,如 ZK/etcd 拒绝服务保正确)还是 A(可用性,如 Eureka/Nacos AP 返回旧数据)
distributed-transaction-solutions skill 分布式事务方案选型 — 2PC 强一致但慢、TCC 高性能但侵入、Saga 适合长流程、本地消息表/MQ 最终一致、最大努力通知兜底,按一致性强度与侵入成本选
distributed-idempotent-design skill 幂等设计 — 同一请求/消息重复执行结果一致,手段按场景选:唯一索引/去重表(插入类)、Token 令牌(防重复提交)、状态机(流转类)、乐观锁(更新类),接口幂等 + 消息幂等
distributed-id skill 分布式 ID 算法选型(理论视角)— 雪花算法本地生成但有时钟回拨、号段模式趋势递增依赖 DB、Redis incr 简单、UUID 无序不宜做主键,按是否要有序/是否依赖中心组件取舍

分布式理论 · 子项索引

分布式理论拆成四个独立选型决策点,按你正在做的取舍下钻:

你在做什么 进哪个
选注册中心/存储的一致性模型,纠结要一致性还是可用性 cap-tradeoff
跨服务/跨库要保证一致,选哪种分布式事务方案 transaction-solutions
接口可能被重试/消息可能重投,要保证执行一次效果 idempotent-design
给分布式系统选全局唯一 ID 的生成算法 distributed-id