当前位置:网站首页>Envoy source code flow chart
Envoy source code flow chart
2022-08-01 11:32:00 【Zhao Huabing】
最近在实现 MetaProtocol 时阅读了 Envoy Some relevant source code.The timing diagrams of some important processes are recorded here,以备后续查看.
TCP Proxy
TCP Proxy 时序图
Dubbo Proxy
Dubbo Proxy 时序图
RDS
RDS(路由发现服务)The code includes the following three main processes:
- 订阅 RDS
- 执行线程:Main Thread
- 工作流程:RDS subscription is at HCM The configuration factory class handles it,详细流程如下:
- Envoy 在初始化 Network Filter Chain 时调用 HttpConnectionManagerFilterConfigFactory 的 createFilterFactoryFromProtoTyped 方法.
- One is created in this method RouteConfigProviderManager 对象.Only one single instance will be created in the code,所有的 HCM The initialization process will share one RouteConfigProviderManager Singleton 对象.由于所有 HCM 初始化都是在 Main Thread 中进行的,因此对该 Singleton There will be no concurrency conflicts for access.(相关代码)
- 根据 HCM The routing configuration is RDS Still static configuration,分别创建 RdsRouteConfigProvider 或者 StaticRouteConfigProvider (相关代码).One is created in this method RdsRouteConfigSubscription 对象,This object is responsible for the specific subscription logic,然后再以 RdsRouteConfigSubscription 作为参数来创建 RdsRouteConfigSubscription.注意这里 RdsRouteConfigProvider Examples are and RDS 配置的 hash 值一一对应的,同样的 RDS 配置(即 config_source 和 route_config_name 相同),只会创建一个 RdsRouteConfigProvider,以避免多个 HCM Repeat for the same subscription RDS.如果一个 RDS 配置对应的 RdsRouteConfigProvider 已经存在,will have existing RdsRouteConfigProvider 返回给 HCM .即多个 HCM 配置的 RDS 相同的话,会共用一个 RdsRouteConfigProvider 实例. (相关代码).
- 在 RdsRouteConfigSubscription 的构造方法中,会从 context 中拿到 ClusterManager 的SubscriptionFactory,然后通过 subscriptionFromConfigSource 方法对该 RDS 进行订阅. subscriptionFromConfigSource method will use itself asSubscriptionCallbacks 参数,以接收 RDS 更新通知.(相关代码)
- 处理 RDS 的配置更新
- 执行线程:Main Thread
- 工作流程:
- RdsRouteConfigSubscription 的 onConfigUpdate 方法收到 RDS Configure the updated callback,然后调用 RdsRouteConfigProvider 的 onConfigUpdate 方法.(相关代码)
- RdsRouteConfigProvider 通过 Thread local storage The mechanism updates the configuration to each worker thread 中.
- 使用 RDS Configure to route requests
- 执行线程:Worker Thread
- 工作流程:
- Envoy 调用到 Network Filter Chain 中的 HCM filter.
- HCM filter 调用到 HTTP Filter Chain 中的 Router.
- Router 拿到缓存的 RDS 配置,根据 RDS Configure for routing.
RDS 时序图
边栏推荐
- The use of Ts - Map type
- Promise learning (2) An article takes you to quickly understand the common APIs in Promise
- 深入理解 Istio —— 云原生服务网格进阶实战
- Introduction to STM32 development Introduce IIC bus, read and write AT24C02 (EEPROM) (using analog timing)
- LeakCanary如何监听Service、Root View销毁时机?
- 在线GC日志分析工具——GCeasy
- Aeraki Mesh 正式成为 CNCF 沙箱项目
- 小程序毕设作品之微信美食菜谱小程序毕业设计成品(3)后台功能
- 一篇文章,带你详细了解华为认证体系证书(1)
- [Cloud Residency Co-Creation] Huawei Cloud Global Scheduling Technology and Practice of Distributed Technology
猜你喜欢

leetcode/submatrix element sum

EasyRecovery热门免费数据检测修复软件

数字化转型实践:世界级2B数字化营销的方法框架

jmeter

.NET性能优化-使用SourceGenerator-Logger记录日志

Flutter Widget 如何启用和屏蔽点击事件

新书上市 |《谁在掷骰子?》在“不确定性时代”中确定前行

Why Metropolis–Hastings Works

Endorsed in 2022 years inventory | product base, science and technology, guangzhou automobile group striding forward

Mysql index related knowledge review one
随机推荐
Introduction to data warehouse layering (real-time data warehouse architecture)
NIO‘s Sword(思维,取模,推公式)
利用正则表达式的回溯实现绕过
Qt获取文件夹下所有文件
.NET深入解析LINQ框架(三:LINQ优雅的前奏)
The use of Ts - Map type
深入理解 Istio —— 云原生服务网格进阶实战
【社区明星评选】第24期 8月更文计划 | 笔耕不辍,拒绝躺平!更多原创激励大礼包,还有华为WATCH FIT手表!
数字化转型实践:世界级2B数字化营销的方法框架
语音聊天app源码——语音聊天派对
July 31, 2022 -- Take your first steps with C# -- Use arrays and foreach statements in C# to store and iterate through sequences of data
JS 中的 undefined 和 null 的区别
Why Metropolis–Hastings Works
DBPack SQL Tracing 功能及数据加密功能详解
通配符SSL证书不支持多域名吗?
R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化密度图、使用stat_central_tendency函数在密度中添加均值竖线并自定义线条类型
轮询和长轮询的区别
每日一题:连续子数组的最大和(动态规划)
For small applications, which database is better to use?
Generate certificates using KeyStore