当前位置:网站首页>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 时序图
边栏推荐
- slice、splice、split傻傻分不清
- Dapr 与 NestJs ,实战编写一个 Pub & Sub 装饰器
- 深入理解 Istio —— 云原生服务网格进阶实战
- WPF 截图控件之绘制箭头(五)「仿微信」
- ModelArts-based object detection YOLOv3 practice [play with HUAWEI CLOUD]
- leetcode/子矩阵元素和
- Promise学习(四)异步编程的终极解决方案async + await:用同步的方式去写异步代码
- shell--面试题
- Small application project works WeChat gourmet recipes applet graduation design of finished product (1) the development profile
- 数字化转型实践:世界级2B数字化营销的方法框架
猜你喜欢
随机推荐
.NET深入解析LINQ框架(三:LINQ优雅的前奏)
从零开始Blazor Server(4)--登录系统
Promise learning (2) An article takes you to quickly understand the common APIs in Promise
MFC implementation road map navigation system
Endorsed in 2022 years inventory | product base, science and technology, guangzhou automobile group striding forward
(ES6以上以及TS) Map对象转数组
JWT
如何设计一个分布式 ID 发号器?
重庆市大力实施智能建造,推动建筑业数字化转型,助力“建造强市”
MySQL常用语句总结
Istio Meetup China:全栈服务网格 - Aeraki 助你在 Istio 服务网格中管理任何七层流量
Introduction to STM32 development Introduce IIC bus, read and write AT24C02 (EEPROM) (using analog timing)
Mysql index related knowledge review one
腾讯云原生:Areaki Mesh 在 2022 冬奥会视频直播应用中的服务网格实践
[Open class preview]: Research and application of super-resolution technology in the field of video quality enhancement
深入理解 Istio —— 云原生服务网格进阶实战
July 31, 2022 -- Take your first steps with C# -- Use C# to create readable code with conventions, spaces, and comments
在线GC日志分析工具——GCeasy
表连接详解
千万级乘客排队系统重构&压测方案——总结篇








