使用arthas 生成火焰图分析jvm
arthas 是阿里巴巴开源的强大的jvm 应该分析工具,以下是使用arthas 生成jvm 火焰图的一个学习
项目使用docker-compose 运行,对于生成的火焰图使用nginx 提供一个访问入口
环境准备
- docker-compose 文件
version: "3"
services:
web:
image: openresty/openresty:alpine
ports:
- "8090:80"
volumes:
- "./flamegraph:/opt/mywebs"
- "./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
app:
build: ./
cap_add:
- ALL
ports:
- "8080:8080"
volumes:
- "./flamegraph:/usr/local/tomcat/arthas-output"
- tomcat 集成arthas dockerfile
FROM tomcat
# copy arthas
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
- nginx config
worker_processes 1;
user root;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
lua_code_cache off;
lua_need_request_body on;
gzip on;
resolver 127.0.0.11 ipv6=off;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
gzip_min_length 2k;
gzip_buffers 4 16k;
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
gzip_comp_level 4;
gzip_types text/plain text/css image/png application/javascript image/jpeg image/gif;
server {
listen 80;
server_name _;
charset utf-8;
default_type text/html;
root /opt/mywebs;
location / {
default_type text/plain;
autoindex on;
}
location = /empty {
empty_gif;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
使用
- 启动
docker-compose up -d
- 进入tomcat 启动arthas
docker-compose exec app sh
java -jar /opt/arthas/arthas-boot.jar
选择进程id 默认为1
- 开启profiler
生成火焰图
profiler start
- 一个简单的压力测试
ab -n 20000 -c 200 http://localhost:8080/
- 停止profiler
profiler stop
- 查看火焰图

说明
以上是一个简单的学习使用,开启容器的profiler 需要添加cap 为了简单,添加了all,arthas 功能很强大,是一把利器,同时集成到docker
镜像中,可以方便的分析一些性能瓶颈
参考资料
https://alibaba.github.io/arthas/
https://github.com/rongfengliang/arthas-docker-demo
https://github.com/alibaba/arthas
使用arthas 生成火焰图分析jvm的更多相关文章
- 火焰图分析openresty性能瓶颈
注:本文操作基于CentOS 系统 准备工作 用wget从https://sourceware.org/systemtap/ftp/releases/下载最新版的systemtap.tar.gz压缩包 ...
- 用 CPI 火焰图分析 Linux 性能问题
https://yq.aliyun.com/articles/465499 用 CPI 火焰图分析 Linux 性能问题 yangoliver 2018-02-11 16:05:53 浏览1076 ...
- 火焰图分析CPU性能问题
1.找出应用程序或内核消耗CPU的PID 2.执行perf record 命令,记录该PID的行为 perf record -a -g -p 14851 -- sleep 30 --30秒后退出 3. ...
- perf + Flame Graph火焰图分析程序性能
1.perf命令简要介绍 性能调优时,我们通常需要分析查找到程序百分比高的热点代码片段,这便需要使用 perf record 记录单个函数级别的统计信息,并使用 perf report 来显示统计结果 ...
- [转]perf + 火焰图分析程序性能
1.perf命令简要介绍 性能调优时,我们通常需要分析查找到程序百分比高的热点代码片段,这便需要使用 perf record 记录单个函数级别的统计信息,并使用 perf report 来显示统计结果 ...
- perf + 火焰图分析程序性能
1.perf命令简要介绍 性能调优时,我们通常需要分析查找到程序百分比高的热点代码片段,这便需要使用 perf record 记录单个函数级别的统计信息,并使用 perf report 来显示统计结果 ...
- Skynet服务热点火焰图分析
最近花了一周时间对场景服务进行热点分析,利用以前的火焰图工具做了一点微小的贡献,分享下心得(仓库地址在https://github.com/spin6lock/skynet_systemtap_set ...
- 利用火焰图分析ceph pg分布
前言 性能优化大神Brendan Gregg发明了火焰图来定位性能问题,通过图表就可以发现问题出在哪里,通过svg矢量图来查看性能卡在哪个点,哪个操作占用的资源最多 在查看了原始数据后,这个分析的原理 ...
- 使用FlameGraph火焰图分析JAVA应用性能
开源项目推荐 Pepper Metrics是我与同事开发的一个开源工具(https://github.com/zrbcool/pepper-metrics),其通过收集jedis/mybatis/ht ...
随机推荐
- [转]python 中的[:-1]和[::-1]
转自:https://blog.csdn.net/mingyuli/article/details/81604795 1.案例解释a='python'b=a[::-1]print(b) #nohtyp ...
- 匿名函数和for_each用法
匿名函数,C++11的 for_each 用法 #include <iostream> #include <algorithm> #include "testClas ...
- SqlHelper发布——比你期望的还要多的多(例如比MyBatis-Pagehelper性能更高)
SqlHelper发布——比Mybatis-PageHelper性能更高 起源 前段时间开启了一个新的项目,在选择分页插件时,发现github上很流行的一个是pagehelper,在百度上搜索了一下, ...
- Autoware 笔记 No. 5——基于GNSS的定位
1. 前言 在之前的笔记No.2 中,我们直接采用ndt_matching的方法实现定位,但需要在打开rviz中,通过2D Pose Estimate指定初始位置.加入GNSS后,可以帮助ndt_ma ...
- 一小段 Dapper 的简单示例
关于 Dapper 的介绍,请参考:Dapper - 一款轻量级对象关系映射(ORM)组件,DotNet 下 using System; using System.Collections.Generi ...
- Spring Cloud Feign 服务消费调用(三)
序言 Spring Cloud Netflix的微服务都是以HTTP接口的形式暴露的,所以可以用Apache的HttpClient或Spring的RestTemplate去调用 而Feign是一个使用 ...
- 一个jetty部署多个项目配置之方法一
https://my.oschina.net/wangyongqing/blog/115647 Jetty用户经常想配置他们的web应用到不同的虚拟主机. 通常情况下,一个单一的IP地址的机器有不同的 ...
- C# 改变控制台背景颜色
之前查找静态构造函数相关的问题无意间碰到的一个问题.改变控制台的背景颜色. static void Main(string[] args) { //设置绿色 Console.BackgroundCol ...
- C# Random
一.简介 在Random类用于创建随机数.(当然是伪随机的.) 二.Random用法 例: Random rnd = new Random(); int month = rnd.Next(1, 13) ...
- EF CodeFirst 使用T4模板
实用等级:★★★★★ 首先,定义一个接口,代表一个领域实体.在定义一个实体集成这个接口,面向接口编程的各种好处就不提了. /// <summary> /// 代表一个领域实体 /// &l ...