flame graphs

什么是性能分析? (What is Profiling?)

Profiling is the act of analyzing the performance of applications in order to improve poorly performing sections of code.One of the most popular ways to visualize a profile and quickly identifying performance issues is by generating a Flame Graph.

概要分析是分析应用程序性能以改善代码段性能的行为。可视化配置文件并快速识别性能问题的最流行方法之一是生成“火焰图”。

The y-axis is stack depth, and the x-axis spans the sample population. Each rectangle is a function, where the width shows how often it was present in the profile. The ordering from left to right is unimportant (the stacks are sorted alphabetically).

y轴是堆栈深度,x轴跨越样本总体。 每个矩形都是一个函数,其中的宽度表示它在配置文件中出现的频率。 从左到右的顺序并不重要(堆栈按字母顺序排序)。

问题:在Kubernetes上进行概要分析 (The Problem: Profiling on Kubernetes)

Profiling is a non-trivial task. Most profilers have two main problems:

概要分析是一项艰巨的任务。 大多数探查器有两个主要问题:

  • Require application modifications. Usually, either by adding flags to the execution command or by importing some profiling library into your code.需要修改应用程序。 通常,可以通过将标志添加到执行命令或将一些性能分析库导入代码中来实现。
  • Profiling in production is typically avoided due to the significant performance hit during the profiling process.由于在性能分析过程中会严重影响性能,因此通常避免在产品中进行性能分析。

Choosing the right profiler may solve those problems, but it requires research and usually depends on the programming language and the operating system.

选择正确的探查器可能会解决这些问题,但是这需要进行研究,并且通常取决于编程语言和操作系统。

Profiling is even harder when performed on applications running inside a Kubernetes cluster. A new container image, which includes the profiling modifications, needs to be deployed instead of the currently running container. In addition, some performance issues may disappear when an application restarts, which makes debugging difficult.

在Kubernetes集群中运行的应用程序上执行分析时,甚至更加困难。 需要部署一个包含配置文件修改的新容器映像,而不是当前正在运行的容器。 此外,当应用程序重新启动时,某些性能问题可能会消失,这使调试变得困难。

解决方案:kubectl火焰 (The Solution: kubectl flame)

Kubectl flame is a kubectl plugin that makes profiling applications running in Kubernetes a smooth experience without requiring any application modifications or downtime. Also, kubectl flame aims to be production-friendly by minimizing the performance hit.

Kubectl Flame是一个kubectl插件,可以使在Kubernetes中运行的分析应用程序获得流畅的体验,而无需进行任何应用程序修改或停机。 另外,kubectl flame的目标是通过最大程度地降低性能损失来实现生产友好。

The plugin currently supports JVM based languages (additional languages support is coming soon!).

该插件当前支持基于JVM的语言(即将支持其他语言!)。

用法 (Usage)

演示地址

kubectl flame in action
kubectl火焰在起作用

分析Kubernetes Pod (Profiling Kubernetes Pod)

To profile pod mypod for 1 minute and save the flame graph as /tmp/flamegraph.svg run:

要配置pod mypod 1分钟,并将火焰图保存为/tmp/flamegraph.svg,请运行:

kubectl flame mypod -t 1m -f /tmp/flamegraph.svg

分析基于阿尔卑斯的容器 (Profiling Alpine based container)

Profiling alpine based containers require using — alpine flag:

对基于高山的容器进行概要分析需要使用-高山标志:

kubectl flame mypod -t 1m -f /tmp/flamegraph.svg --alpine

分析侧面车集装箱 (Profiling sidecar container)

Pods that contain more than one container require specifying the target container as an argument:

包含多个容器的Pod需要指定目标容器作为参数:

kubectl flame mypod -t 1m -f /tmp/flamegraph.svg mycontainer

这个怎么运作 (How it works)

Kubectl flame uses the most performant profiler for every supported language. A vital requirement of a supported profiler is being able to profile without any changes to the target process. The profiling flow is started by launching a profiler container on the same node as the target container. Most profilers will need to share some resources with the target container:PID namespace sharing is enabled by setting hostPID to true.Filesystem sharing is enabled by mounting /var/lib/docker and querying overlayFS.The current JVM support is based on async-profiler.

Kubectl Flame对每种受支持的语言使用性能最高的探查器。 受支持的探查器的一项至关重要的要求是能够探查而不对目标过程进行任何更改。 通过在与目标容器相同的节点上启动探查器容器来启动分析流程。 大多数探查器将需要与目标容器共享一些资源:通过将hostPID设置为true来启用PID名称空间共享。通过挂载/ var / lib / docker并查询overlayFS来启用文件系统共享。当前的JVM支持基于async-profiler 。

kubectl flame overview
kubectl火焰概述

未来发展 (Future Development)

The following features are already in progress and should be available in the next versions of kubectl flame:

以下功能已经在开发中,并且在下一版本的kubectl flame中应该可用:

  • Golang support via eBPF profiling通过eBPF分析支持Golang
  • Auto-detection of target container programming language自动检测目标容器编程语言
  • Python supportPython支持
  • Support Kubernetes clusters not based on Docker as a container runtime (Kind)

    支持不基于Docker的Kubernetes集群作为容器运行时( Kind )

摘要 (Summary)

Performance-related issues are among the hardest bugs to solve. Next time you face performance problems in your production system, consider using kubectl flame to identify the root cause quickly.

与性能相关的问题是最难解决的错误。 下次在生产系统中遇到性能问题时,请考虑使用kubectl flame快速确定根本原因。

The kubectl flame source code is available on this Github repository.Feel free to reach out or submit pull requests if you have any suggestions.

这个Github仓库提供了kubectl flame源代码。如有任何建议,请随时与我们联系或提交拉取请求。

翻译自: https://medium.com/@edeNFed/introducing-kubectl-flame-effortless-profiling-on-kubernetes-4b80fc181852

flame graphs


http://www.taodudu.cc/news/show-5833477.html

相关文章:

  • 【论文阅读笔记】FLAME: Taming Backdoors in Federated Learning
  • perf+flame分析程序性能,并生成火焰图。
  • Flame:史上最危险的病毒
  • Flutter 游戏教程之使用 Flutter 和 Flame 重现著名的 T-Rex 游戏
  • Flutter游戏制作flame官方范例(一)打蚊子
  • FlutterFlame——TankCombat游戏手柄开发(一)
  • 火焰( flame)
  • Flame Graphs 火焰图安装与使用
  • flame-fitting 在ubuntu环境配置
  • 个人仪表板软件Flame
  • FLAME人脸模型+blender 人脸编辑
  • 【FlutterFlame游戏 - 拾伍】粒子系统 | ParticleSystemComponent
  • 腾讯面试官分享面试经验,如何考察面试者技术及个人综合素质,给正在面试的你一点建议
  • 腾讯面试——AI岗
  • 2021最新腾讯面经分享:知识大纲+技术文档+面试专题
  • 第6章 使用过滤器和监听器
  • python3解释器执行long(10)的结果为_python3解释器执行d = dict.fromkeys([
  • java项目1DVD管理器
  • 【Iterator模式】C++设计模式——迭代器
  • 模板引擎:二、实现一个Json解析器
  • Vim 编辑器:如何增加或减少日期、时间、数字和序数
  • CSS3元素与选择器
  • 分享职场心得《2》
  • 银行笔试金融试题
  • 高频Fiddler软件测试面试题
  • 2023年软件测试面试题,精选100 道,内附答案
  • 「软件测试面试干货」2023年软件测试面试题大全(持续更新)附答案..
  • Layer already exists
  • 创建module提示“Module ‘----‘already exists”
  • RuntimeError: Address already in use

flame graphs_在kubernetes上引入kubectl flame轻松分析相关推荐

  1. 安装k8s pod性能分析工具Kubectl Flame

    一.环境准备: 1.k8s集群,k8s krew插件 2.krew安装可以参考:https://blog.csdn.net/weixin_47003048/article/details/113967 ...

  2. 【云原生】Java 应用程序在 Kubernetes 上棘手的内存管理

    文章目录 引言 JVM 内存模型简介 非 Heap 内存 Heap 堆内存 Kubernetes 内存管理 JVM 和 Kubernetes 场景 1 - Java Out Of Memory 错误 ...

  3. 使用Netsil监控Kubernetes上的微服务

    ubernetes是容器编排和调度领域的王者,它击败了竞争对手Docker Swarm和Apache Mesos,开启了闪耀的未来,微服务可以自修复,可以自动扩展,可以跨zone,region甚至跨云 ...

  4. 在Kubernetes上运行SAP UI5应用(下): 一个例子体会Kubernetes内容器的高可用性和弹性伸缩...

    2019独角兽企业重金招聘Python工程师标准>>> 上一篇文章 在Kubernetes上运行SAP UI5应用(上),我介绍了如何在Docker里运行一个简单的SAP UI5应用 ...

  5. 在 Kubernetes 上弹性深度学习训练利器 -- Elastic Training Operator

    作者 | 徐晓舟(萧元) 来源|阿里巴巴云原生公众号 背景 由于云计算在资源成本和弹性扩容方面的天然优势,越来越多客户愿意在云上构建 AI 系统,而以容器.Kubernetes 为代表的云原生技术,已 ...

  6. SpringCloud 应用在 Kubernetes 上的最佳实践 —— 高可用(容量评估)

    作者 | 牛兔 导读:本文是<SpringCloud 应用在 Kubernetes 上的最佳实践>系列文章的第 11 篇,从前面两期开始我们进入到了高可用专题,分别介绍了流量防护和故障演练 ...

  7. Spring Cloud 应用在 Kubernetes 上的最佳实践 — 高可用(混沌工程)

    作者 | 穹谷 导读:从上篇开始,我们进入到了高可用的章节,上篇提到的熔断能力,是历年保障大促当天晚上整个系统不被洪峰流量打垮的法宝.本文将重点介绍为什么我们要做混沌工程以及如何使用 ChaoBlad ...

  8. SpringCloud 应用在 Kubernetes 上的最佳实践 — 线上发布(可回滚)

    作者 | 长门 **导读:**本篇是<SpringCloud 应用在 Kubernetes 上的最佳实践>系列文章的第七篇,主要介绍了新功能上线时,如何尽快减少对线上用户的影响?发布系统需 ...

  9. 在 Kubernetes 上弹性深度学习训练利器 - Elastic Training Operator

    简介:由于云计算在资源成本和弹性扩容方面的天然优势,越来越多客户愿意在云上构建 AI 系统,而以容器.Kubernetes 为代表的云原生技术,已经成为释放云价值的最短路径, 在云上基于 Kubern ...

最新文章

  1. 技嘉主板bios设置键盘不能用_BIOS不再硬梆梆、全新技嘉主板BIOS设置就算不是玩家也能轻松搞定...
  2. 腾讯AR开放平台今日正式开放,提供识别、追踪、展现等多项能力
  3. android响铃停止源代码,android – 如何停止当前正在播放的铃声?
  4. mysql分析表增删改统计_MySQL增删改查|附思维导图
  5. 从零入门 Serverless | Serverless 应用如何管理日志 持久化数据
  6. 为什么不读顶级会议论文?
  7. 初识Mysql(一)
  8. 在ASP.NET网站中实现带列表(其由xml文件控制生成)的视频播放
  9. 设计原则在设计模式的应用
  10. 死锁的处理策略——避免死锁
  11. 深度学习在图像检索的应用
  12. Nowcoder 提高组练习赛-R2
  13. 阿里巴巴内部Jetpack宝典意外流出!Android岗
  14. 路由器DRCOM教程
  15. windows server 2019 安装CA-证书服务器
  16. win10系统跟Linux系统哪个好,Linux比Windows10系统好吗?Linux vs Win10测试
  17. windows 2008 R2 感染Ramnit.x病毒查杀方法
  18. 通过网格拆分高德地图
  19. Apollo planning之PiecewiseJerkPathOptimizer
  20. Linux下R环境安装

热门文章

  1. 【错误记录】自定义 Gradle 插件报错 ( Could not find implementation class x for plugin x specified in jar:file )
  2. ofstream文件输出流把二进制数据写入文件
  3. android surface 平板,微软开发折叠屏 Surface 平板,可运行 Android 应用
  4. 羊毛出在狗身上猪来买单
  5. 阅读笔记 - Pointer Network
  6. Python 中%d,%s等特殊符号的含义
  7. 阿里新推出「瓴羊DaaS」,有没有前途?
  8. 自己写linux usb转串口 驱动
  9. 微信儿童版要来了?有点可爱! 有点黄!
  10. VMware Horizon 8 2303 - 虚拟桌面基础架构 (VDI) 和应用软件