十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

Arthas 简单使用说明

上一篇 / 下一篇  2019-06-20 13:37:46 / 个人分类:性能测试

文章来源
  • 文章来源:【原创】
启动arthas
1、修改文件权限与JAVA程序的运行用户一致
[root@5-140 PRG]# chown -R resin:resin arthas
 
2、切换用户到java程序用户
[root@5-140 PRG]# su - resin
 
3、进入arthas目录
[resin@5-140 ~]$ cd /data/PRG/arthas/
 
4、运行arthas
[resin@5-140 arthas]$ /usr/java/jdk1.6.0_32/bin/java -jar arthas-boot.jar 10410
注:
运行的jdk要与要分析的jvm的java版本一致
10410 为 要分析的java 进程的PID号
 
开始分析
 
5、查看dashboard
输入dashboard,按回车/enter,会展示当前进程的信息,按ctrl+c可以中断执行。
ID           NAME                                 GROUP                     PRIORITY    STATE        %CPU        TIME         INTERRUPTED DAEMON       
36           AsyncAppender-Worker-arthas-cache.re system                    5           WAITING      0           0:0          false       true         
4            Attach Listener                      system                    5           RUNNABLE     0           0:0          false       true         
27           DestroyJavaVM                        main                      5           RUNNABLE     0           0:1          false       false        
3            Finalizer                            system                    8           WAITING      0           0:0          false       true         
9            RMI TCP Accept-0                     system                    5           RUNNABLE     0           0:0          false       true         
2            Reference Handler                    system                    10          WAITING      0           0:0          false       true         
47           Timer-for-arthas-dashboard-cbeef016- system                    10          RUNNABLE     0           0:0          false       true         
46           as-command-execute-daemon            system                    10          TIMED_WAITIN 0           0:0          false       true         
23           hmux-127.0.0.1:6091-0$332139135      main                      5           RUNNABLE     0           0:0          false       true         
38           job-timeout                          system                    5           TIMED_WAITIN 0           0:0          false       true         
39           nioEventLoopGroup-2-1                system                    10          RUNNABLE     0           0:0          false       false        
43           nioEventLoopGroup-2-2                system                    10          RUNNABLE     0           0:0          false       false        
45           nioEventLoopGroup-2-3                system                    10          RUNNABLE     0           0:0          false       false        
40           nioEventLoopGroup-3-1                system                    10          RUNNABLE     0           0:0          false       false        
41           pool-1-thread-1                      system                    5           TIMED_WAITIN 0           0:0          false       false        
42           pool-2-thread-1                      system                    5           WAITING      0           0:0          false       false        
29           resin-12                             main                      5           TIMED_WAITIN 0           0:0          false       true         
30           resin-13                             main                      5           TIMED_WAITIN 0           0:0          false       true         
31           resin-14                             main                      5           TIMED_WAITIN 0           0:0          false       true         
32           resin-15                             main                      5           TIMED_WAITIN 0           0:0          false       true         
33           resin-16                             main                      5           TIMED_WAITIN 0           0:0          false       true         
Memory                           used      total      max        usage      GC                                                                         
heap                             24M       29M        29M        84.31%     gc.ps_scavenge.count                  265                                  
ps_eden_space                    5M        5M         5M         96.25%     gc.ps_scavenge.time(ms)               3694                                 
ps_survivor_space                1M        2M         2M         53.57%     gc.ps_marksweep.count                 0                                    
ps_old_gen                       18M       21M        21M        85.08%     gc.ps_marksweep.time(ms)              0                                    
nonheap                          25M       27M        130M       19.90%                                                                                
code_cache                       1M        2M         48M        2.27%                                                                                 
ps_perm_gen                      24M       24M        82M        30.21%                                                                                
                                                                                                                                                       
                                                                                                                                                       
                                                                                                                                                       
Runtime                                                                                                                                                
os.name                                                                     Linux                                                                      
os.version                                                                  2.6.18-164.el5                                                             
java.version                                                                1.6.0_32                                                                   
java.home                                                                   /usr/java/jdk1.6.0_32/jre                                                  
systemload.average                                                          0.02                                                                       
processors                                                                  4                                                                          
uptime                                                                      1728213s

6、 通过thread命令来获取到进程的Main Class
$ thread 29
"resin-12" Id=29 TIMED_WAITING on com.caucho.util.ThreadPool$Item@77f6d2e3
    at java.lang.Object.wait(Native Method)
    -  waiting on com.caucho.util.ThreadPool$Item@77f6d2e3
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:714)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:649)
    at java.lang.Thread.run(Thread.java:662)

Affect(row-cnt:0) cost in 62 ms.
更多测试资料请查看 http://www.tbaike.com/

&o6Rg4A*]&O"]^`0

TAG: Arthas

 

评分:0

我来说两句

Open Toolbar