jvm 相关工具

2 篇文章 0 订阅
2 篇文章 0 订阅

jvm 相关工具



官方文档:
https://alibaba.github.io/arthas/
用于查看方法的输入输出,验证环境中的class是否最新扥。

安装参考:
https://alibaba.github.io/arthas/manual-install.html

均部署了arthas 在目录:
/usr/local/arthas

arthas

部署启动查看方法输入输出方式方式

解压后

./install-local.sh

然后使用

sudo su tomcat 

进入Tomcat用户下执行

./as.sh

(或者可以直接使用命令:sudo -u tomcat -EH ./as.sh )
注:此步骤出现权限问题提示的话,在root模型下创建对应目录/home/tomcat
然后赋权限: chown -R tomcat /home/tomcat

根据出现的pid 选择需要attached的进程

之后输入对应数字即可

查看方法输入输出方式

watch com.xxx.quartz.xxxQuartz syncRule "{params,returnObj}" -x 4
 watch com.xxx.xxController * "{params,returnObj}" -x 2
 watch com.xxx.service.UserService save "{params,returnObj}" -x 4 
 
 条件过滤
 watch com.xxx.redis.CacheTaskRedis  spop   "{params,returnObj}" 'params[0] == "value-sr"' -x 4 

查看当前class的反编译

jad com.xxx.xxController

getstatic 获取静态值

getstatic com.xxx.util.XXXCache   retryFlag
getstatic com.xxx.memoryEntity.xxxEntity   includeCephMap -x 4
getstatic com.xxx.xxxEntity xxMap 'entrySet().iterator.{? #this.key.equals("values")}'
getstatic com.xxx.Log currentMap "size()"

async-profile 火焰图

官网:

https://github.com/jvm-profiling-tools/async-profiler

下载最新版本:async-profiler-1.7.1-linux-x64.tar.gz

Linux x64 (glibc): async-profiler-1.7.1-linux-x64.tar.gz

使用

解压:
tar xvf async-profiler-1.7.1-linux-x64.tar.gz
执行命令:

./profiler.sh -d 60 -f /tmp/profile.svg 16401

CPU耗时脚本

show-busy-java-threads

官网:

https://github.com/oldratlee/useful-scripts/blob/dev-2.x/docs/java.md#-show-busy-java-threads

打包下载

wget --no-check-certificate https://github.com/oldratlee/useful-scripts/archive/release-2.x.zip

unzip release-2.x.zip

下载单个文件

wget --no-check-certificate https://raw.github.com/oldratlee/useful-scripts/release-2.x/bin/show-busy-java-threads

chmod +x show-busy-java-threads

./show-busy-java-threads

典型使用

/ap/bin/useful-scripts-dev-2.x/bin/show-busy-java-threads -p 42511

耗时操作

grep “java” /tmp/linwz/jstack421 |awk ‘{a[$2]++}END{for (j in a) print j","a[j]}’|sort -t ‘,’ -k 2 -n -r|less -N

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值