当前位置:网站首页>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 时序图
边栏推荐
- Promise学习(三)Promise的几个关键性问题 -- 状态改变、执行顺序与机制、多任务串联、异常穿透、中断promise链
- 万字解析:vector类
- 如何获取微信视频号的地址(微信公众号的链接地址)
- R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化密度图、使用stat_central_tendency函数在密度中添加均值竖线并自定义线条类型
- [Nodejs] node的fs模块
- 如何设计一个分布式 ID 发号器?
- shell--第九章练习
- 【无标题】
- The four methods of judging JS data type
- Generate certificates using KeyStore
猜你喜欢
华硕和微星多款产品将升级英特尔Arc A380和A310显卡
LeakCanary如何监听Service、Root View销毁时机?
2022 Go ecosystem rpc framework Benchmark
.NET性能优化-使用SourceGenerator-Logger记录日志
Promise to learn several key questions (3) the Promise - state change, execution sequence and mechanism, multitasking series, abnormal penetration, interrupt the chain of Promise
稀疏表示--学习笔记
Promise learning (1) What is Promise?how to use?How to solve callback hell?
jmeter
冰冰学习笔记:gcc、gdb等工具的使用
leetcode/submatrix element sum
随机推荐
js中常用追加元素的几种方法:append,appendTo,after,before,insertAfter,insertBefore,appendChild
Solve vscode input! Unable to quickly generate skeletons (three methods for the new version of vscode to quickly generate skeletons)
上周热点回顾(7.25-7.31)
新一代超安全蜂窝电池, 思皓爱跑上市13.99万元起售
如何获取微信视频号的地址(微信公众号的链接地址)
Promise学习(三)Promise的几个关键性问题 -- 状态改变、执行顺序与机制、多任务串联、异常穿透、中断promise链
shell--第九章练习
一篇文章,带你详细了解华为认证体系证书(2)
Promise learning (1) What is Promise?how to use?How to solve callback hell?
C#/VB.NET 将PPT或PPTX转换为图像
R语言拟合ARIMA模型:使用forecast包中的auto.arima函数自动搜索最佳参数组合、模型阶数(p,d,q)、设置seasonal参数指定在模型中是否包含季节信息
Promise learning (2) An article takes you to quickly understand the common APIs in Promise
What is a stepper motor?40 pictures to show you!
DBPack SQL Tracing 功能及数据加密功能详解
Drawing arrows of WPF screenshot control (5) "Imitation WeChat"
【CLion】CLion 总是提示 “This file does not belong to any project target xxx” 的解决方法
如何设计一个分布式 ID 发号器?
基于ArkUI eTS开发的坚果食谱(NutRecipes)
Aeraki Mesh 正式成为 CNCF 沙箱项目
pgAdmin 4 v6.12 发布,PostgreSQL 开源图形化管理工具