You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "robocanic (via GitHub)" <gi...@apache.org> on 2025/07/13 11:34:18 UTC
[D] 2025-07-13 weekly [dubbo-admin]
GitHub user robocanic created a discussion: 2025-07-13 weekly
# 重构
## Discovery 和 Engine 的重构思路
Discovery 和 Engine从本质上来说其实都是一个list-watch模型。不同的是,Discovery watch的数据源一般是注册中心如zk,nacos等,而Engine watch的一般是应用运行引擎如kubernetes,docker compose, vm等。kubernetes中提供了[client-go](https://github.com/kubernetes/client-go)来抽象并实现了list watch这个机制:
<img width="1200" height="630" alt="image" src="https://github.com/user-attachments/assets/60959338-b848-4a57-aa6f-3d1f41d47db4" />
1. Reflector: ListWatch k8s apiserver,监听指定类型的变更事件,将变更信息push 到 Delta FIFO队列中
2. Informer: 从 Delta FIFO 读出事件,调用Indexer,完成持久化,并分发事件
3. Indexer:内存索引&存储代理,依托KeyFunc维护索引,调用store的方法后需要更新索引
<img width="1350" height="991" alt="image" src="https://github.com/user-attachments/assets/6b9d0674-d82b-4b12-8b25-75060680b460" />
5. Store: 存储层,key-value类型的存储结构,client-go中已有memory实现
<img width="1713" height="1380" alt="image" src="https://github.com/user-attachments/assets/2fbf0d48-d31d-43c3-99af-7320abba160b" />
我们可以将admin中的一些组件映射到上面这张图,Indexer和Store和上图中的组件的定位一模一样,从接口上来说,可以完全复用:
而Discovery和Engine从定位上则包含了Reflector,Queue,Informer这几个组件,即**包含了从指定数据源进行ListWatch,队列缓冲,事件分发,再调用Indexer完成持久化这一过程**
## 任务表
| 需求 | 模块 | 负责人 | 等级 | 进度 |
| ---------------- | ------------------------------------------------------ | ------ | ---- | ---- |
| 基础模块统一改造 | 目录结构 冗余代码迁移 配置改造 | 陈才 | p0 | done |
| | 日志库 工具库 error定义和处理 (包括对现有的代码改造) | 钟坚 | p1 | |
| 领域模型改造 | 应用,实例,服务等 | 陈才 | p0 | 80% |
| 数据存储改造 | Store的DB实现 | | p1 | |
| | Indexer的实现 | | p2 | |
| | Discovery的zk/nacos实现 | 王天意 | p2 | |
| | Engine的k8s实现 | | p2 | |
#
GitHub link: https://github.com/apache/dubbo-admin/discussions/1301
----
This is an automatically sent email for notifications@dubbo.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [D] 2025-07-13 weekly [dubbo-admin]
Posted by "robocanic (via GitHub)" <gi...@apache.org>.
GitHub user robocanic edited a discussion: 2025-07-13 weekly
# 重构
## Discovery 和 Engine 的重构思路
Discovery 和 Engine从本质上来说其实都是一个list-watch模型。不同的是,Discovery watch的数据源一般是注册中心如zk,nacos等,而Engine watch的一般是应用运行引擎如kubernetes,docker compose, vm等。kubernetes中提供了[client-go](https://github.com/kubernetes/client-go)来抽象并实现了list watch这个机制:
<img width="1200" height="630" alt="image" src="https://github.com/user-attachments/assets/60959338-b848-4a57-aa6f-3d1f41d47db4" />
1. Reflector: ListWatch k8s apiserver,监听指定类型的变更事件,将变更信息push 到 Delta FIFO队列中
2. Informer: 从 Delta FIFO 读出事件,调用Indexer,完成持久化,并分发事件
3. Indexer:内存索引&存储代理,依托KeyFunc维护索引,调用store的方法后需要更新索引
<img width="1350" height="991" alt="image" src="https://github.com/user-attachments/assets/6b9d0674-d82b-4b12-8b25-75060680b460" />
5. Store: 存储层,key-value类型的存储结构,client-go中已有memory实现
<img width="1713" height="1380" alt="image" src="https://github.com/user-attachments/assets/2fbf0d48-d31d-43c3-99af-7320abba160b" />
我们可以将admin中的一些组件映射到上面这张图,Indexer和Store和上图中的组件的定位一模一样,从接口上来说,可以完全复用:
而Discovery和Engine从定位上则包含了Reflector,Queue,Informer这几个组件,即**包含了从指定数据源进行ListWatch,队列缓冲,事件分发,再调用Indexer完成持久化这一过程**
## 任务表
| 需求 | 模块 | 负责人 | 等级 | 进度 |
| ---------------- | ------------------------------------------------------ | ------ | ---- | ---- |
| 基础模块统一改造 | 目录结构 冗余代码迁移 配置改造 | @robocanic | p0 | done |
| | 日志库 工具库 error定义和处理 (包括对现有的代码改造) | @mfordjody | p1 | |
| 领域模型改造 | 应用,实例,服务等 | @robocanic | p0 | 80% |
| 数据存储改造 | Store的DB实现 | | p1 | |
| | Indexer的实现 | | p2 | |
| | Discovery的zk/nacos实现 | @tianyi | p2 | |
| | Engine的k8s实现 | | p2 | |
#
GitHub link: https://github.com/apache/dubbo-admin/discussions/1301
----
This is an automatically sent email for notifications@dubbo.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org