性能测试-arthas的使用

下载 arthas

官方网站:https://arthas.aliyun.com/doc

[root@master ~]#  curl -O https://arthas.aliyun.com/arthas-boot.jar

运行 arthas

会展示当前计算机执行的java的进程,可以通过序号+enter选择需要监控的进程,完成后进入命令行模式(第一次使用会下载15.7M的文件)

[root@master arthas]# java -jar arthas-boot.jar 
[INFO] JAVA_HOME: /usr/local/java/jdk1.8.0_412/jre
[INFO] arthas-boot version: 4.0.2
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 3263 math-game.jar
 1
1
[INFO] arthas home: /root/.arthas/lib/4.0.2/arthas
[INFO] The target process already listen port 3658, skip attach.
[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    4.0.2                                                                
main_class                                                                      
pid        3263                                                                 
time       2024-10-18 15:17:41.285                                              

[arthas@3263]$ 

官方使用手册地址:https://arthas.aliyun.com/doc/commands.html#基础命令

在官方文档命令行中可以输入指定的命令查看当前java进程的相关信息

查看jvm信息

[arthas@3263]$ jvm
 RUNTIME                                                                                                                                                                                                               
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MACHINE-NAME                                                 3263@master                                                                                                                                              
 JVM-START-TIME                                               2024-10-18 15:06:15                                                                                                                                      
 MANAGEMENT-SPEC-VERSION                                      1.2                                                                                                                                                      
 SPEC-NAME                                                    Java Virtual Machine Specification                                                                                                                       
 SPEC-VENDOR                                                  Oracle Corporation                                                                                                                                       
 SPEC-VERSION                                                 1.8                                                                                                                                                      
 VM-NAME                                                      OpenJDK 64-Bit Server VM                                                                                                                                 
 VM-VENDOR                                                    BiSheng                                                                                                                                                  
 VM-VERSION                                                   25.412-b11                                                                                                                                               
 INPUT-ARGUMENTS                                              []                                                                                                                                                       
 CLASS-PATH                                                   math-game.jar                                                                                                                                            
 BOOT-CLASS-PATH                                              /usr/local/java/jdk1.8.0_412/jre/lib/resources.jar:/usr/local/java/jdk1.8.0_412/jre/lib/rt.jar:/usr/local/java/jdk1.8.0_412/jre/lib/sunrsasign.jar:/usr/ 
                                                              local/java/jdk1.8.0_412/jre/lib/jsse.jar:/usr/local/java/jdk1.8.0_412/jre/lib/jce.jar:/usr/local/java/jdk1.8.0_412/jre/lib/charsets.jar:/usr/local/java/ 
                                                              jdk1.8.0_412/jre/lib/jfr.jar:/usr/local/java/jdk1.8.0_412/jre/classes                                                                                    
 LIBRARY-PATH                                                 /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib                                                                                             

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 CLASS-LOADING                                                                                                                                                                                                         
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 LOADED-CLASS-COUNT                                           4386                                                                                                                                                     
 TOTAL-LOADED-CLASS-COUNT                                     4386                                                                                                                                                     
 UNLOADED-CLASS-COUNT                                         0                                                                                                                                                        
 IS-VERBOSE                                                   false                                                                                                                                                    

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 COMPILATION                                                                                                                                                                                                           
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 NAME                                                         HotSpot 64-Bit Tiered Compilers                                                                                                                          
 TOTAL-COMPILE-TIME                                           9979                                                                                                                                                     
 [time (ms)]                                                                                                                                                                                                           

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 GARBAGE-COLLECTORS                                                                                                                                                                                                    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 PS Scavenge                                                  name : PS Scavenge                                                                                                                                       
 [count/time (ms)]                                            collectionCount : 4                                                                                                                                      
                                                              collectionTime : 1362                                                                                                                                    
 PS MarkSweep                                                 name : PS MarkSweep                                                                                                                                      
 [count/time (ms)]                                            collectionCount : 1                                                                                                                                      
                                                              collectionTime : 821                                                                                                                                     

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MEMORY-MANAGERS                                                                                                                                                                                                       
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 CodeCacheManager                                             Code Cache                                                                                                                                               
 Metaspace Manager                                            Metaspace                                                                                                                                                
                                                              Compressed Class Space                                                                                                                                   
 PS Scavenge                                                  PS Eden Space                                                                                                                                            
                                                              PS Survivor Space                                                                                                                                        
 PS MarkSweep                                                 PS Eden Space                                                                                                                                            
                                                              PS Survivor Space                                                                                                                                        
                                                              PS Old Gen                                                                                                                                               

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MEMORY                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HEAP-MEMORY-USAGE                                            init : 65011712(62.0 MiB)                                                                                                                                
 [memory in bytes]                                            used : 32105744(30.6 MiB)                                                                                                                                
                                                              committed : 63438848(60.5 MiB)                                                                                                                           
                                                              max : 917504000(875.0 MiB)                                                                                                                               
 NO-HEAP-MEMORY-USAGE                                         init : 2555904(2.4 MiB)                                                                                                                                  
 [memory in bytes]                                            used : 34259800(32.7 MiB)                                                                                                                                
                                                              committed : 35258368(33.6 MiB)                                                                                                                           
                                                              max : -1(-1 B)                                                                                                                                           
 PENDING-FINALIZE-COUNT                                       0                                                                                                                                                        

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 OPERATING-SYSTEM                                                                                                                                                                                                      
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 OS                                                           Linux                                                                                                                                                    
 ARCH                                                         amd64                                                                                                                                                    
 PROCESSORS-COUNT                                             2                                                                                                                                                        
 LOAD-AVERAGE                                                 0.55                                                                                                                                                     
 VERSION                                                      3.10.0-1127.el7.x86_64                                                                                                                                   

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 THREAD                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 COUNT                                                        15                                                                                                                                                       
 DAEMON-COUNT                                                 14                                                                                                                                                       
 PEAK-COUNT                                                   15                                                                                                                                                       
 STARTED-COUNT                                                19                                                                                                                                                       
 DEADLOCK-COUNT                                               0                                                                                                                                                        

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 FILE-DESCRIPTOR                                                                                                                                                                                                       
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MAX-FILE-DESCRIPTOR-COUNT                                    4096                                                                                                                                         
 OPEN-FILE-DESCRIPTOR-COUNT                                   67                

查看内存信息

[arthas@3263]$ memory
Memory                                                                                      used                           total                          max                           usage                          
heap                                                                                        32M                            60M                            875M                          3.69%                          
ps_eden_space                                                                               25M                            31M                            323M                          7.81%                          
ps_survivor_space                                                                           0K                             2560K                          2560K                         0.00%                          
ps_old_gen                                                                                  7M                             27M                            656M                          1.07%                          
nonheap                                                                                     32M                            34M                            -1                            96.58%                         
code_cache                                                                                  5M                             5M                             240M                          2.30%                          
metaspace                                                                                   24M                            25M                            -1                            96.26%                         
compressed_class_space                                                                      2M                             3M                             1024M                         0.29%                          
direct                                                                                      8K                             8K                             -                             100.01%                        
mapped                                                                                      0K                             0K                             -                             0.00%                          

查看thread信息

[arthas@3263]$ thread 
Threads Total: 22, NEW: 0, RUNNABLE: 9, BLOCKED: 0, WAITING: 3, TIMED_WAITING: 3, TERMINATED: 0, Internal threads: 7                                                                                                   
ID       NAME                                                  GROUP                      PRIORITY          STATE            %CPU              DELTA_TIME        TIME              INTERRUPTED       DAEMON            
-1       C1 CompilerThread1                                    -                          -1                -                5.89              0.011             0:3.211           false             true              
-1       C2 CompilerThread0                                    -                          -1                -                1.21              0.002             0:3.426           false             true              
20       arthas-command-execute                                system                     5                 RUNNABLE         0.25              0.000             0:0.330           false             true              
-1       VM Periodic Task Thread                               -                          -1                -                0.17              0.000             0:2.693           false             true              
-1       VM Thread                                             -                          -1                -                0.03              0.000             0:0.358           false             true              
2        Reference Handler                                     system                     10                WAITING          0.0               0.000             0:0.007           false             true              
3        Finalizer                                             system                     8                 WAITING          0.0               0.000             0:0.008           false             true              
4        Signal Dispatcher                                     system                     9                 RUNNABLE         0.0               0.000             0:0.001           false             true              
8        Attach Listener                                       system                     9                 RUNNABLE         0.0               0.000             0:0.081           false             true              
10       arthas-timer                                          system                     9                 WAITING          0.0               0.000             0:0.000           false             true              
13       arthas-NettyHttpTelnetBootstrap-3-1                   system                     5                 RUNNABLE         0.0               0.000             0:0.114           false             true              
14       arthas-NettyWebsocketTtyBootstrap-4-1                 system                     5                 RUNNABLE         0.0               0.000             0:0.005           false             true              
15       arthas-NettyWebsocketTtyBootstrap-4-2                 system                     5                 RUNNABLE         0.0               0.000             0:0.005           false             true              
16       arthas-shell-server                                   system                     9                 TIMED_WAITING    0.0               0.000             0:0.007           false             true              
17       arthas-session-manager                                system                     9                 TIMED_WAITING    0.0               0.000             0:0.010           false             true              
19       arthas-NettyHttpTelnetBootstrap-3-2                   system                     5                 RUNNABLE         0.0               0.000             0:0.736           false             true              
22       arthas-NettyHttpTelnetBootstrap-3-3                   system                     5                 RUNNABLE         0.0               0.000             0:0.068           false             true              
23       arthas-NettyHttpTelnetBootstrap-3-4                   system                     5                 RUNNABLE         0.0               0.000             0:0.173           false             true              
1        main                                                  main                       5                 TIMED_WAITING    0.0               0.000             0:1.852           false             false             
-1       GC task thread#1 (ParallelGC)                         -                          -1                -                0.0               0.000             0:1.734           false             true              
-1       GC task thread#0 (ParallelGC)                         -                          -1                -                0.0               0.000             0:1.708           false             true              
-1       Service Thread                                        -                          -1                -                0.0               0.000             0:0.000           false             true              
posted @   tigerMao  阅读(47)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示