当前位置:网站首页>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 时序图
边栏推荐
- 博弈论(Depu)与孙子兵法(42/100)
- 每日一题:连续子数组的最大和(动态规划)
- C#/VB.NET 将PPT或PPTX转换为图像
- 【随心笔记】假期快过去了,都干了点什么
- bat倒计时代码
- 判断JS数据类型的四种方法
- 基于ArkUI eTS开发的坚果食谱(NutRecipes)
- 进制与转换、关键字
- R语言检验时间序列的平稳性:使用tseries包的adf.test函数实现增强的Dickey-Fuller(ADF)检验、检验时序数据是否具有均值回归特性(平稳性)、具有均值回归特性的案例
- 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学习(一)Promise是什么?怎么用?回调地狱怎么解决?
一篇文章,带你详细了解华为认证体系证书(1)
Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (2) Mini Program Functions
Pytest电商项目实战(下)
千万级乘客排队系统重构&压测方案——总结篇
石头科技打造硬核品牌力 持续出海拓展全球市场
OpenHarmony高校技术俱乐部计划发布
Promise learning (4) The ultimate solution for asynchronous programming async + await: write asynchronous code in a synchronous way
回归预测 | MATLAB实现TPA-LSTM(时间注意力注意力机制长短期记忆神经网络)多输入单输出
Promise learning (2) An article takes you to quickly understand the common APIs in Promise
随机推荐
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
NIO‘s Sword(思维,取模,推公式)
sql中ddl和dml(数据库表与视图的区别)
【倒计时5天】探索音画质量提升背后的秘密,千元大礼等你来拿
如何获取微信视频号的地址(微信公众号的链接地址)
Several methods of appending elements are commonly used in js: append, appendTo, after, before, insertAfter, insertBefore, appendChild
Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (3) Background Functions
R语言两个时间序列数据的滞后相关性可视化:使用forecast包的ccf函数绘制交叉相关函数,根据可视化结果分析滞后相关性
mysql进阶(二十二)MySQL错误之Incorrect string value中文字符输入错误问题分析
深入理解 Istio —— 云原生服务网格进阶实战
轮询和长轮询的区别
R语言检验时间序列的平稳性:使用tseries包的adf.test函数实现增强的Dickey-Fuller(ADF)检验、检验时序数据是否具有均值回归特性(平稳性)、具有均值回归特性的案例
R语言ggplot2可视化:使用ggpubr包的ggscatter函数可视化散点图、使用xscale函数指定X轴坐标轴度量调整方式、设置x轴坐标为scientific使用科学计数法显示坐标值
万字解析:vector类
pgAdmin 4 v6.12 发布,PostgreSQL 开源图形化管理工具
Promise learning (1) What is Promise?how to use?How to solve callback hell?
R语言ggplot2可视化:使用ggpubr包的geom_exec函数执行geom_*函数(没有任何参数需要放置在aes中)
程序员如何优雅地解决线上问题?
大众碰到点评的一个字体反爬,落地技术也是绝了
[5 days countdown] to explore the secret behind the great quality promotion, gift waiting for you to take of $one thousand