zoukankan      html  css  js  c++  java
  • 内存监控工具arthas使用

    快速入门参考链接:https://arthas.gitee.io/quick-start.html

    1、arthas安装

    arthas下载地址
    https://arthas.aliyun.com/download/latest_version?mirror=aliyun
    安装方法
    解压zip文件至指定文件夹
    unzip arthas-packaging-3.5.4-bin.zip -d arthas
    进入文件夹cd arthas

    2、启动

    java -jar arthas-boot.jar

    [root@localhost opt]# cd arthas
    [root@localhost arthas]# java -jar arthas-boot.jar
    [INFO] arthas-boot version: 3.5.4
    [INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
    * [1]: 25030 com.code.common.mist.exec.MistExecEngineExecutor
      [2]: 11718 org.apache.catalina.startup.Bootstrap
      [3]: 9737 org.apache.zookeeper.server.quorum.QuorumPeerMain
      [4]: 11097 org.apache.catalina.startup.Bootstrap
    1
    [INFO] arthas home: /opt/arthas
    [INFO] Try to attach process 25030
    [INFO] Attach process 25030 success.
    [INFO] arthas-client connect 127.0.0.1 3658
      ,---. ,------. ,--------.,--. ,--. ,---. ,---.
     / O \ | .--. ''--. .--'| '--' | / O \ ' .-'
    | .-. || '--'.' | | | .--. || .-. |`. `-.
    | | | || |\ \ | | | | | || | | |.-' |
    `--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
    
    
    wiki https://arthas.aliyun.com/doc
    tutorials https://arthas.aliyun.com/doc/arthas-tutorials.html
    version 3.5.4
    main_class
    pid 25030
    time 2021-12-09 14:41:36
    
    

    3、查看日志

    cat /root/logs/arthas/arthas.log

    4、查看dashboard

    输入dashboard,按回车/enter,会展示当前进程的信息,按ctrl+c可以中断执行。

    ctrl+c结束
    通过thread命令来获取到math-game进程的Main Class
    输入命令:thread 1 | grep 'main('

    通过jad来反编译Main Class
    输入命令:jad com.code.common.mist.exec.MistExecEngineExecutor

    通过watch命令查看函数返回的值
    例:watch demo.MathGame primeFactors returnObj

    如果要重新开始另外一个java进程需停止原来的
    java -jar arthas-client.jar 127.0.0.1 3658 -c "stop"

  • 相关阅读:
    ASP.NET中级学习3
    C#面向对象学习笔记
    Javascript学习笔记
    FormView控件使用
    ASP.NET初级学习
    ListView控件是使用
    Java NIO 学习笔记一
    堆栈和托管堆 c#
    安装php7.2并且整合nginx且分开部署
    Python 安装requests和MySQLdb
  • 原文地址:https://www.cnblogs.com/seamy/p/15672945.html
Copyright © 2011-2022 走看看