通过火焰图学习nginx upstream 模块的处理

以下几个图是关于upstream 调用链的

参考环境准备

基于了flamescope 结合perf 文件可以方便的学习

  • flamescope 准备
version: "3"
services: 
  flamescope:
     image: dalongrong/flamescope
     ports: 
     - "5000:5000"
     volumes: 
     - "./profiles:/profiles"

profiles 目录的文件可以直接从github 获取 rongfengliang/openresty-perf

参考火焰图

  • 单进程模式

通过下图我们再结合源码学习nginx 的单进程模式就很简单了

 

 

多进程模式

 

 

说明

以上是基于火焰图学习nginx upstream 处理的一种方法思路,可以提高我们代码学习的速度,同时也方便模块调用分析

参考资料

https://github.com/baishancloud/nginx-development-guide/blob/master/zh.md
https://github.com/rongfengliang/openresty-perf
https://hub.docker.com/repository/docker/dalongrong/flamescope
https://github.com/rongfengliang/openresty-perf

posted on 2022-04-05 11:42  荣锋亮  阅读(66)  评论(0编辑  收藏  举报

导航