《劉愷--eBPF與Golang Profiling:阿里云的探索與實踐.pdf》由會員分享,可在線閱讀,更多相關《劉愷--eBPF與Golang Profiling:阿里云的探索與實踐.pdf(21頁珍藏版)》請在三個皮匠報告上搜索。
1、eBPF 與 Golang Profiling 阿里云的探索與實踐第二屆 eBPF開發者大會w w w.e b p f t r a v e l.c o m劉愷(千陸)2024-04-13第 二 屆 e B P F 開 發 者 大 會個人簡介劉愷花名千陸,阿里云高級研發工程師,目前負責云原生可觀測團隊 eBPF 基礎設施。持續深耕監控及可觀測領域,在可觀測方案架構及落地方面有著多年實踐經驗與深刻見解。目前,作為eBPF探針及K8s監控的研發負責人,積極探索容器可觀測及關聯場景,為企業提供開箱即用的可觀測產品與服務。第 二 屆 e B P F 開 發 者 大 會1.Profiling 與 Gola
2、ng 2.Continuous Profiling3.Golang Runtime 診斷第 二 屆 e B P F 開 發 者 大 會為什么需要 Profiling?OPTIMAZATIONOPTIMAZATIONINCIDENTSINCIDENTS第 二 屆 e B P F 開 發 者 大 會Golang Profiling 生態ProfilerMethodologyDeploymentTraces Lib/Sys Calls?overheadgopprofVisualizationRecompile&RerunYesVery High(20 x*)delverun-time instrum
3、entationProfile any running processYesvarygperftoolsrun-time instrumentationRecompile&RerunYesvaryeBPFAttach probe to kernel or user elfProfile any running processYesLow開銷較高開銷較高侵入性強侵入性強即時診斷能力弱即時診斷能力弱四個挑戰:四個挑戰:可擴展性弱可擴展性弱第 二 屆 e B P F 開 發 者 大 會1.Profiling 與 Golang 2.Continuous Profiling3.Golang Runtim
4、e 診斷第 二 屆 e B P F 開 發 者 大 會什么是 Continuous Profiling?PixieParcaPyroscopeContinuous Profiling 是持續監控和記錄程序性能特征的工具,能夠協助開發者充分保留現場并發現性能瓶頸。第 二 屆 e B P F 開 發 者 大 會CPU Continuous Profiling 架構打造低開銷、無侵入低開銷、無侵入的工具第 二 屆 e B P F 開 發 者 大 會CPU Continuous Profiling 性能優化第 二 屆 e B P F 開 發 者 大 會成果展示第 二 屆 e B P F 開 發 者 大
5、 會1.Profiling 與 Golang 2.Continuous Profiling3.Golang Runtime 診斷第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 概述Runtime 診斷能夠對運行中的應用進行 diagnose,能夠幫助開發者發現預期外的異常。delvedelveeBPFeBPF侵入性無侵入無侵入環境要求較高較低性能一般較高擴展性較低較高第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 eBPF 面臨的問題棧幀解析參數解析uretprobeGolangGolang 的的 ABIABI 規規范不同于范不同于C C 語言語言不同版
6、本編譯器遵不同版本編譯器遵循的循的 ABIABI 規范也不規范也不同同識別參數類型識別參數類型解析參數的解析參數的ValueValueGolangGolang 內置了很內置了很多復雜的數據結多復雜的數據結構構uretprobeuretprobe 的實現的實現原理與原理與 GolangGolang 語語言的設計理念有言的設計理念有沖突沖突第 二 屆 e B P F 開 發 者 大 會Golang 棧幀介紹/12 params,11 returnfunc addFunc(x int,y int,z int,a,b,c int,d,e,f int,g,h,l int)(int,int,int,int
7、,int,int,int,int,int,int,int)return 1,2,3,4,5,6,7,8,9,10,11func main()addFunc(1,2,3,4,5,6,7,8,9,10,11,12)Go1.17以前,所有的參數和返回值都放在棧上 Go1.17及以后,前9個參數和返回值使用寄存器,之后的參數和返回值使用棧第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 參數類型第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 參數解析基礎類型基礎類型stringstring 類型類型sliceslice 類型類型struct struct 類型類型第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 uretprobe第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 uretprobe 通過通過 uprobeuprobe 掛載到掛載到 returnreturn 符號地址來模擬符號地址來模擬 uretprobeuretprobe 行為行為第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 架構第 二 屆 e B P F 開 發 者 大 會Runtime 診斷 結果展示第 二 屆 e B P F 開 發 者 大 會THANKS