基础教程

举报
西魏陶渊明 发表于 2022/09/25 01:10:34 2022/09/25
【摘要】 # 一、启动Arthas curl -O https://arthas.aliyun.com/arthas-boot.jarjava -jar arthas-boot.jar 1 2 启动命令 java -jar arthas-boot.jar # 二、选择进程 直接选择我们要...

# 一、启动Arthas


        curl -O https://arthas.aliyun.com/arthas-boot.jar
        java -jar arthas-boot.jar
    
   
1 2

启动命令 java -jar arthas-boot.jar

# 二、选择进程

直接选择我们要监控的进程,输入3进入


        [INFO] Attach process 28667 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.6
        main_class com.example.demo.DemoApplication
        pid 28667
        time 2022-03-13 21:31:04
    
   
1 2 3 4 5 6 7 8 9 10 11 12 13 14

提示已经连接上进程。

# 三、基础信息查询命令

# 3.1 dashboard 看板命令

输入 dashboard

会定时将应用信息输出到控制台上。

# 3.2 jad 反向编译

jad com.example.demo.DemoApplication

# 3.3 watch 监控指令

这个命令是比较常用的命令,可以用来分析系统性能。


        package com.example.demo;
        import org.springframework.web.bind.annotation.GetMapping;
        import org.springframework.web.bind.annotation.ResponseBody;
        import org.springframework.web.bind.annotation.RestController;
        @RestController
        public class WebController {
           @GetMapping("/get")
           @ResponseBody
           public String get(String name) {
               return name;
            }
        }
    
   
1 2 3 4 5 6 7 8 9 10 11 12 13 14

监控这个类 watch com.example.demo.WebController get returnObj

参数名 含义
returnObj 返回值
params 入参
target 方法调用方

watch com.example.demo.WebController get {params,returnObj,target}


        [arthas@32818]$ watch com.example.demo.WebController get returnObj
        Press Q or Ctrl+C to abort.
        Affect(class count: 1 , method count: 1) cost in 120 ms, listenerId: 1
        method=com.example.demo.WebController.get location=AtExit
        ts=2022-03-13 21:41:56; [cost=1.317166ms] result=@String[123]
        method=com.example.demo.WebController.get location=AtExit
        ts=2022-03-13 21:42:03; [cost=0.051875ms] result=@String[测试]
    
   
1 2 3 4 5 6 7

# 四、退出

输入 q

文章来源: springlearn.blog.csdn.net,作者:西魏陶渊明,版权归原作者所有,如需转载,请联系作者。

原文链接:springlearn.blog.csdn.net/article/details/125858130

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。