首页 > 其他分享 >性能测试-arthas的使用

性能测试-arthas的使用

时间:2024-12-15 14:55:11浏览次数:7  
标签:false 0.0 性能 -------------------------------------------------------------------

下载 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              

标签:false,0.0,性能,-------------------------------------------------------------------
From: https://www.cnblogs.com/maojh/p/18607986

相关文章

  • Centos Stream安装测试1
    犯了一个错误:在设置Root用户的时候设置了LockRootuser,也就是锁定root用户,然后无论登陆多少遍,输入了多少遍密码都无法使用root用户。也算长记性了哈哈不过也不算毫无收获,至少在CentosStream/usr/kbd/consolefonts目录下测试了很多字体setfontlat4a-16+.psfu.gzsetfontlat4......
  • 性能测试-内存溢出时的分析工具使用
    下载内存分析工具地址:https://eclipse.dev/mat/downloads.phphp)下载对应的版本,我这里使用的windows的就下载windows版本的包,下载完成后解压配置启动时的jdk的依赖,目前1.15.0版本的需要jdk17以上,我们在启动时需要手工修改MemoryAnalyzer.ini文件,添加指定的jdk的本地路径-vm......
  • 性能测试-对当前环境磁盘读写能力的检查
    1.1检查当前磁盘的使用情况[root@master~]#df文件系统1K-块已用可用已用%挂载点devtmpfs2001044020010440%/devtmpfs2013080020130800%/dev/shmtmpfs......
  • 性能测试-linux下的常用命令汇总
    1.1cup使用率进行排序[root@master~]#top-ctop-20:45:36up1:14,4users,loadaverage:0.45,0.85,0.53Tasks:125total,1running,124sleeping,0stopped,0zombie%Cpu(s):11.2us,15.3sy,0.0ni,73.3id,0.0wa,0.0hi,0.2si,0.0......
  • 性能测试-jvm监控工具jconsole
    在jdk的bin目录下,运行jconsole.exe程序可以打开工具在使用java命令启动服务时添加如下参数-Dcom.sun.management.jmxremote                    #启用jmx-Djava.rmi.server.hostname=10.0.0.100                    #运行的......
  • 性能测试工具-iperf3网络带宽验证工具
    1.1iperf3工具的安装由于iperf3工具是测试两台计算机之间的网络带宽的工具,因此需要再两台计算机上都进行安装[root@slave~]#yuminstalliperf3-y已加载插件:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.......
  • 性能测试工具-iftop实时流量监控工具
    1.1iftop工具安装[root@master~]#yuminstalliftop-y已加载插件:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.aliyun.com*updates:mirrors.aliyun.com正在解决依赖关系-->正在检查事务--->软件包if......
  • 性能测试工具-nmon工具(Linux的资源监控)
    1.1下载nmon工具官方网站下载地址:https://nmon.sourceforge.io/pmwiki.php?n=Site.Download下载nmon16e_mpginc.tar.gz的安装包1.2nmon工具早Centos7的安装解压文件nmon16e_mpginc.tar.gz#创建目录将压缩文件内容加压到该目录[root@mastertgz]#mkdir-p/opt/app/......
  • 2.1.3-2 第二次Reactor代码(百万并发测试过程的报错信息)
    零、概述做服务器性能测试的时候,并发量、QPS(每秒处理多少请求)、时迟(延迟,每个请求多长时间返回)、测试用例(业务代码,发什么数据和回什么数据)这四组都是重要的参数。并发→网络io的并发,是服务端最基础的技能。备注:研发和运营的数据不相同。一、报错信息serverip:192......
  • Jmeter接口测试-图片验证码的识别
    Jmeter接口测试-对图片验证码的识别Jmeter接口测试-对验证码的识别##大概说一下思路,以及方法,我的接口接口的返回值是img/base64编码的,我采用的是OCRServer识别,获取返回值,图片保存到本地,再图片转码base64,之后携带数据请求OCR识别。(网上的办法是接口这种base64位的编码,可以直接请......