mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-20 22:17:09 +08:00
[docs add]Gossip 协议详解
This commit is contained in:
parent
8c48313596
commit
7dae89cfc0
@ -327,9 +327,10 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
|
||||
|
||||
### 理论&算法&协议
|
||||
|
||||
- [CAP 理论和 BASE 理论解读](./docs/distributed-system/theorem&algorithm&protocol/cap&base-theorem.md)
|
||||
- [Paxos 算法解读](./docs/distributed-system/theorem&algorithm&protocol/paxos-algorithm.md)
|
||||
- [Raft 算法解读](./docs/distributed-system/theorem&algorithm&protocol/raft-algorithm.md)
|
||||
- [CAP 理论和 BASE 理论详解](./docs/distributed-system/theorem&algorithm&protocol/cap&base-theorem.md)
|
||||
- [Paxos 算法详解](./docs/distributed-system/theorem&algorithm&protocol/paxos-algorithm.md)
|
||||
- [Raft 算法详解](./docs/distributed-system/theorem&algorithm&protocol/raft-algorithm.md)
|
||||
- [Gossip 协议详解](./docs/distributed-system/theorem&algorithm&protocol/gossip-protocl.md)
|
||||
|
||||
### API 网关
|
||||
|
||||
|
@ -430,7 +430,12 @@ export const sidebarConfig = sidebar({
|
||||
text: "理论&算法&协议",
|
||||
icon: "suanfaku",
|
||||
prefix: "theorem&algorithm&protocol/",
|
||||
children: ["cap&base-theorem", "paxos-algorithm", "raft-algorithm"],
|
||||
children: [
|
||||
"cap&base-theorem",
|
||||
"paxos-algorithm",
|
||||
"raft-algorithm",
|
||||
"gossip-protocl",
|
||||
],
|
||||
},
|
||||
"api-gateway",
|
||||
"distributed-id",
|
||||
|
@ -1,4 +1,9 @@
|
||||
# ZooKeeper 实战
|
||||
---
|
||||
title: ZooKeeper 实战
|
||||
category: 分布式
|
||||
tag:
|
||||
- ZooKeeper
|
||||
---
|
||||
|
||||
这篇文章简单给演示一下 ZooKeeper 常见命令的使用以及 ZooKeeper Java客户端 Curator 的基本使用。介绍到的内容都是最基本的操作,能满足日常工作的基本需要。
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
|
||||
|
||||
# ZooKeeper 相关概念总结(入门)
|
||||
---
|
||||
title: ZooKeeper 相关概念总结(入门)
|
||||
category: 分布式
|
||||
tag:
|
||||
- ZooKeeper
|
||||
---
|
||||
|
||||
相信大家对 ZooKeeper 应该不算陌生。但是你真的了解 ZooKeeper 到底有啥用不?如果别人/面试官让你给他讲讲对于 ZooKeeper 的认识,你能回答到什么地步呢?
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
# ZooKeeper 相关概念总结(进阶)
|
||||
---
|
||||
title: ZooKeeper 相关概念总结(进阶)
|
||||
category: 分布式
|
||||
tag:
|
||||
- ZooKeeper
|
||||
---
|
||||
|
||||
> [FrancisQ](https://juejin.im/user/5c33853851882525ea106810) 投稿。
|
||||
|
||||
@ -90,7 +95,7 @@
|
||||
|
||||

|
||||
|
||||
> 这里是 `3PC` 在成功的环境下的流程图,你可以看到 `3PC` 在很多地方进行了超时中断的处理,比如协调者在指定时间内为收到全部的确认消息则进行事务中断的处理,这样能 **减少同步阻塞的时间** 。还有需要注意的是,**`3PC` 在 `DoCommit` 阶段参与者如未收到协调者发送的提交事务的请求,它会在一定时间内进行事务的提交**。为什么这么做呢?是因为这个时候我们肯定**保证了在第一阶段所有的协调者全部返回了可以执行事务的响应**,这个时候我们有理由**相信其他系统都能进行事务的执行和提交**,所以**不管**协调者有没有发消息给参与者,进入第三阶段参与者都会进行事务的提交操作。
|
||||
> 这里是 `3PC` 在成功的环境下的流程图,你可以看到 `3PC` 在很多地方进行了超时中断的处理,比如协调者在指定时间内未收到全部的确认消息则进行事务中断的处理,这样能 **减少同步阻塞的时间** 。还有需要注意的是,**`3PC` 在 `DoCommit` 阶段参与者如未收到协调者发送的提交事务的请求,它会在一定时间内进行事务的提交**。为什么这么做呢?是因为这个时候我们肯定**保证了在第一阶段所有的协调者全部返回了可以执行事务的响应**,这个时候我们有理由**相信其他系统都能进行事务的执行和提交**,所以**不管**协调者有没有发消息给参与者,进入第三阶段参与者都会进行事务的提交操作。
|
||||
|
||||
总之,`3PC` 通过一系列的超时机制很好的缓解了阻塞问题,但是最重要的一致性并没有得到根本的解决,比如在 `PreCommit` 阶段,当一个参与者收到了请求之后其他参与者和协调者挂了或者出现了网络分区,这个时候收到消息的参与者都会进行事务提交,这就会出现数据不一致性问题。
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
title: CAP & BASE理论详解
|
||||
category: 分布式
|
||||
tag:
|
||||
- 分布式协议&算法
|
||||
- 分布式理论
|
||||
---
|
||||
|
||||
经历过技术面试的小伙伴想必对 CAP & BASE 这个两个理论已经再熟悉不过了!
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: CAP & BASE理论详解
|
||||
title: Gossip 协议详解
|
||||
category: 分布式
|
||||
tag:
|
||||
- 分布式协议&算法
|
||||
- 共识算法
|
||||
---
|
||||
|
||||
## 背景
|
||||
@ -31,7 +32,9 @@ Gossip 协议最早是在 ACM 上的一篇 1987 年发表的论文 [《Epidemic
|
||||
|
||||
## Gossip 协议应用
|
||||
|
||||
**1、Redis Cluster 基于 Gossip 协议通信共享信息**
|
||||
NoSQL 数据库 Redis 和 Apache Cassandra、服务网格解决方案 Consul 等知名项目都用到了 Gossip 协议,学习 Gossip 协议有助于我们搞清很多技术的底层原理。
|
||||
|
||||
我们这里以 Redis Cluster 为例说明 Gossip 协议的实际应用。
|
||||
|
||||
我们经常使用的分布式缓存 Redis 的官方集群解决方案(3.0 版本引入) Redis Cluster 就是基于 Gossip 协议来实现集群中各个节点数据的最终一致性。
|
||||
|
||||
@ -54,14 +57,6 @@ Redis Cluster 的节点之间会相互发送多种 Gossip 消息:
|
||||
|
||||
关于 Redis Cluster 的详细介绍,可以查看这篇文章 [Redis 集群详解(付费)](https://javaguide.cn/database/redis/redis-cluster.html) 。
|
||||
|
||||
**2、NoSQL 数据库 Apache Cassandra 集群通过 Gossip 协议来进行动态管理集群节点状态(节点故障检测和恢复)。**
|
||||
|
||||
**3、服务网格解决方案 Consul 使用 Gossip 协议网络内可靠有效地传输新服务和事件的信息。**
|
||||
|
||||
**4、Bitcoin 使用 Gossip 协议来传播交易和区块信息。不过,为了提供更好的隐私保护,CMU 的研究人员提出 蒲公英协议。**
|
||||
|
||||
还有非常多使用 Gossip 协议的应用,学习 Gossip 协议有助于我们搞清很多技术的底层原理。
|
||||
|
||||
## Gossip 协议消息传播模式
|
||||
|
||||
Gossip 设计了两种可能的消息传播模式:**反熵(Anti-Entropy)** 和 **传谣(Rumor-Mongering)**。
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Paxos 算法详细
|
||||
title: Paxos 算法详解
|
||||
category: 分布式
|
||||
tag:
|
||||
- 分布式协议&算法
|
||||
- 共识算法
|
||||
---
|
||||
|
||||
## 背景
|
||||
|
@ -3,6 +3,7 @@ title: Raft 算法详解
|
||||
category: 分布式
|
||||
tag:
|
||||
- 分布式协议&算法
|
||||
- 共识算法
|
||||
---
|
||||
|
||||
> 本文由 [SnailClimb](https://github.com/Snailclimb) 和 [Xieqijun](https://github.com/jun0315) 共同完成。
|
||||
|
@ -331,6 +331,8 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
|
||||
- [CAP 理论和 BASE 理论解读](./distributed-system/theorem&algorithm&protocol/cap&base-theorem.md)
|
||||
- [Paxos 算法解读](./distributed-system/theorem&algorithm&protocol/paxos-algorithm.md)
|
||||
- [Raft 算法解读](./distributed-system/theorem&algorithm&protocol/raft-algorithm.md)
|
||||
- [Gossip 协议详解](./distributed-system/theorem&algorithm&protocol/gossip-protocl.md)
|
||||
|
||||
|
||||
### API 网关
|
||||
|
||||
|
@ -139,7 +139,7 @@ static void testFooBar(String s) {
|
||||
|
||||
删除远程方法调用 (RMI) 激活机制,同时保留 RMI 的其余部分。RMI 激活机制已过时且不再使用。
|
||||
|
||||
## JEP 409:密封类(转正)
|
||||
## JEP 409:密封类(转正)
|
||||
|
||||
密封类由 [JEP 360](https://openjdk.java.net/jeps/360) 提出预览,集成到了 Java 15 中。在 JDK 16 中, 密封类得到了改进(更加严格的引用检查和密封类的继承关系),由 [JEP 397](https://openjdk.java.net/jeps/397) 提出了再次预览。
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user