java tool常用命令分析

java命令

jps

没添加option的时候,默认列出VM标示符号和简单的class或jar名称.
[root@host-172-16-32-29 ~]# jps
2306 jenkins.war
25801 Jps
25502 handler-processor-1.0-SNAPSHOT.jar
-q :仅仅显示VM 标示,不显示jar,class, main参数等信息.
[root@host-172-16-32-29 ~]# jps -q
25841
2306
25502
-m:输出主函数传入的参数. 下的hello 就是在执行程序时从命令行输入的参数
[root@host-172-16-32-29 ~]# jps -m
2306 jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
25964 Jps -m
25502 handler-processor-1.0-SNAPSHOT.jar
-l: 输出应用程序主类完整package名称或jar完整名称.
[root@host-172-16-32-29 ~]# jps -l
2306 /usr/lib/jenkins/jenkins.war
25989 sun.tools.jps.Jps
25502 /home/hualala/handler-processor-1.0-SNAPSHOT.jar
-v: 列出jvm参数, -Xms20m -Xmx50m是启动程序指定的jvm参数
[root@host-172-16-32-29 ~]# jps -v
2306 jenkins.war -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins
26025 Jps -Denv.class.path=.:/home/jdk/lib/dt.jar:/home/jdk/lib/tools.jar -Dapplication.home=/usr/java/jdk1.8.0_131 -Xms8m
25502 handler-processor-1.0-SNAPSHOT.jar -Xms4G -Xmx4G -XX:MaxGCPauseMillis=200 -Xss512K -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Duser.timezone=GMT+08 -Dfile.encoding=UTF-8 -Dspring.profiles.active=dohko -Dlogging.level.root=info

jmap

[root@host-172-16-32-29 ~]# jmap -heap 25502

Attaching to process ID 25502, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.131-b11

using thread-local object allocation.
Parallel GC with 4 thread(s)

Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 4294967296 (4096.0MB)
NewSize = 1431306240 (1365.0MB)
MaxNewSize = 1431306240 (1365.0MB)
OldSize = 2863661056 (2731.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 134217728 (128.0MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 134217728 (128.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
capacity = 938999808 (895.5MB)
used = 938999808 (895.5MB)
free = 0 (0.0MB)
100.0% used
From Space:
capacity = 247463936 (236.0MB)
used = 0 (0.0MB)
free = 247463936 (236.0MB)
0.0% used
To Space:
capacity = 244842496 (233.5MB)
used = 0 (0.0MB)
free = 244842496 (233.5MB)
0.0% used
PS Old Generation
capacity = 2863661056 (2731.0MB)
used = 2863382888 (2730.734718322754MB)
free = 278168 (0.26528167724609375MB)
99.99028628058417% used

18829 interned Strings occupying 1862872 bytes.

[root@host-172-16-32-29 ~]# jmap -histo 25502 |head -30

num #instances #bytes class name


1: 35443818 1167325688 [C
2: 45933571 1102405704 java.lang.String
3: 3539491 849477840 com.hualala.supplychain.report.handler.processor.dao.entity.voucher.VoucherDetailEntity
4: 10618503 424740120 java.math.BigDecimal
5: 42723 159789752 [B
6: 24693 20599240 [Ljava.lang.Object;
7: 262144 6291456 org.apache.logging.log4j.core.async.AsyncLoggerConfigDisruptor L o g 4 j E v e n t W r a p p e r 8 : 71042930024 [ I 9 : 140911556176 j a v a . l a n g . C l a s s 10 : 433031385696 j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p Log4jEventWrapper 8: 7104 2930024 [I 9: 14091 1556176 java.lang.Class 10: 43303 1385696 java.util.concurrent.ConcurrentHashMap Log4jEventWrapper8:71042930024[I9:140911556176java.lang.Class10:433031385696java.util.concurrent.ConcurrentHashMapNode
11: 40001 1280032 org.elasticsearch.common.bytes.BytesArray
12: 40000 960000 org.elasticsearch.common.text.Text
13: 10000 800000 org.elasticsearch.search.internal.InternalSearchHit
14: 1482 782496 io.netty.util.internal.shaded.org.jctools.queues.atomic.MpscAtomicArrayQueue
15: 36144 578304 java.lang.Object
16: 14259 570360 java.util.LinkedHashMap E n t r y 17 : 6198545424 j a v a . l a n g . r e f l e c t . M e t h o d 18 : 15606499392 j a v a . l a n g . r e f . W e a k R e f e r e n c e 19 : 8158456848 j a v a . u t i l . L i n k e d H a s h M a p 20 : 6170447728 [ L j a v a . u t i l . H a s h M a p Entry 17: 6198 545424 java.lang.reflect.Method 18: 15606 499392 java.lang.ref.WeakReference 19: 8158 456848 java.util.LinkedHashMap 20: 6170 447728 [Ljava.util.HashMap Entry17:6198545424java.lang.reflect.Method18:15606499392java.lang.ref.WeakReference19:8158456848java.util.LinkedHashMap20:6170447728[Ljava.util.HashMapNode;
21: 10810 345920 java.util.HashMap N o d e 22 : 210337416 [ L j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p Node 22: 210 337416 [Ljava.util.concurrent.ConcurrentHashMap Node22:210337416[Ljava.util.concurrent.ConcurrentHashMapNode;
23: 7946 317840 java.lang.ref.SoftReference
24: 11780 282720 java.util.IdentityHashMap E n t r y I t e r a t o r EntryIterator EntryIteratorEntry
25: 10000 240000 org.elasticsearch.index.Index
26: 10000 240000 org.elasticsearch.index.shard.ShardId
27: 10000 240000 org.elasticsearch.search.SearchShardTarget

[root@host-172-16-32-29 ~]# jmap -histo:live 25502 |head -30

num #instances #bytes class name


1: 35465987 1168047200 [C
2: 45963026 1103112624 java.lang.String
3: 3541952 850068480 com.hualala.supplychain.report.handler.processor.dao.entity.voucher.VoucherDetailEntity
4: 10625886 425035440 java.math.BigDecimal
5: 42741 159791224 [B
6: 24675 20602120 [Ljava.lang.Object;
7: 262144 6291456 org.apache.logging.log4j.core.async.AsyncLoggerConfigDisruptor L o g 4 j E v e n t W r a p p e r 8 : 70912176648 [ I 9 : 141091558064 j a v a . l a n g . C l a s s 10 : 433341386688 j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p Log4jEventWrapper 8: 7091 2176648 [I 9: 14109 1558064 java.lang.Class 10: 43334 1386688 java.util.concurrent.ConcurrentHashMap Log4jEventWrapper8:70912176648[I9:141091558064java.lang.Class10:433341386688java.util.concurrent.ConcurrentHashMapNode
11: 40001 1280032 org.elasticsearch.common.bytes.BytesArray
12: 40000 960000 org.elasticsearch.common.text.Text
13: 10000 800000 org.elasticsearch.search.internal.InternalSearchHit
14: 1482 782496 io.netty.util.internal.shaded.org.jctools.queues.atomic.MpscAtomicArrayQueue
15: 36257 580112 java.lang.Object
16: 14259 570360 java.util.LinkedHashMap E n t r y 17 : 6198545424 j a v a . l a n g . r e f l e c t . M e t h o d 18 : 15597499104 j a v a . l a n g . r e f . W e a k R e f e r e n c e 19 : 8158456848 j a v a . u t i l . L i n k e d H a s h M a p 20 : 6177448288 [ L j a v a . u t i l . H a s h M a p Entry 17: 6198 545424 java.lang.reflect.Method 18: 15597 499104 java.lang.ref.WeakReference 19: 8158 456848 java.util.LinkedHashMap 20: 6177 448288 [Ljava.util.HashMap Entry17:6198545424java.lang.reflect.Method18:15597499104java.lang.ref.WeakReference19:8158456848java.util.LinkedHashMap20:6177448288[Ljava.util.HashMapNode;
21: 10810 345920 java.util.HashMap N o d e 22 : 210337416 [ L j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p Node 22: 210 337416 [Ljava.util.concurrent.ConcurrentHashMap Node22:210337416[Ljava.util.concurrent.ConcurrentHashMapNode;
23: 7948 317920 java.lang.ref.SoftReference
24: 10000 240000 org.elasticsearch.index.Index
25: 10000 240000 org.elasticsearch.index.shard.ShardId
26: 10000 240000 org.elasticsearch.search.SearchShardTarget
27: 8472 203328 java.beans.MethodRef

[root@host-172-16-32-29 ~]# jstat -gcutil 25502 1000 10

S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.87 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.88 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
0.00 0.00 96.88 99.99 97.28 93.60 316 16.831 437 1208.314 1225.146
参考资料:【1】Linux下Java虚拟机状态监测工具

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值