java 命令简单查看jvm内存使用状况

1、jps 虚拟机进程状况工具

语法  jsp [option] [hostid]

选项作用
-q只显示lvmid
-m输出虚拟机启用时传入main方法参数
-l输出主类全名
-v输出jvm参数

 

注意:

如果在linux环境中jps命令不能输出vmid数据(jdk1.6.0.23/24 bug),需要修改catalina.sh文件

if [ -z "$CATALINA_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Catalina
# CATALINA_TMPDIR="$CATALINA_BASE"/temp
CATALINA_TMPDIR=/tmp
fi

修改CATALINA_TMPDIR路径

 

2、jstat 虚拟机统计信息监控工具

语法:

jstat [option vmid [interval[s|ms]] [count]]

option选项

 

class统计class loader行为信息
compiler统计编译行为信息
gc统计jdk gc时heap信息
gccapacity统计堆内存不同代的heap容量信息
gccause统计gc的情况(同-gcutil)和引起gc的事件
gcnew统计gc时新生代的信息(相比gcutil更详细)
gcnewcapacity统计gc时新生代heap容量
gcold统计gc时,老年区的情况
gcoldcapacity统计gc时,老年区heap容量
gcpermcapacity统计gc时,permanent区heap容量
gcutil统计gc时,heap情况
printcompilation统计编译行为信息

 

 

例如:

jstat -gc 1111 250 2

查看vmid为1111的虚拟机每个250毫秒执行一次,共执行两次

 

结果分析

-class option:Class Loader Statistics

ColumnDescription
LoadedNumber of classes loaded.
BytesNumber of Kbytes loaded.
UnloadedNumber of classes unloaded.
BytesNumber of Kbytes unloaded.
TimeTime spent performing class load and unload operations.

-compiler:HotSpot Just-In-Time Compiler Statistics

ColumnDescription
CompiledNumber of compilation tasks performed.
FailedNumber of compilation tasks that failed.
InvalidNumber of compilation tasks that were invalidated.
TimeTime spent performing compilation tasks.
FailedTypeCompile type of the last failed compilation.
FailedMethodClass name and method for the last failed compilation.

-gc Option:Garbage-collected heap statistics

ColumnDescription
S0CCurrent survivor space 0 capacity (KB).
S1CCurrent survivor space 1 capacity (KB).
S0USurvivor space 0 utilization (KB).
S1USurvivor space 1 utilization (KB).
ECCurrent eden space capacity (KB).
EUEden space utilization (KB).
OCCurrent old space capacity (KB).
OUOld space utilization (KB).
PCCurrent permanent space capacity (KB).
PUPermanent space utilization (KB).
YGCNumber of young generation GC Events.
YGCTYoung generation garbage collection time.
FGCNumber of full GC events.
FGCTFull garbage collection time.
GCTTotal garbage collection time.

-gccapacity Option:Memory Pool Generation and Space Capacities

ColumnDescription
NGCMNMinimum new generation capacity (KB).
NGCMXMaximum new generation capacity (KB).
NGCCurrent new generation capacity (KB).
S0CCurrent survivor space 0 capacity (KB).
S1CCurrent survivor space 1 capacity (KB).
ECCurrent eden space capacity (KB).
OGCMNMinimum old generation capacity (KB).
OGCMXMaximum old generation capacity (KB).
OGCCurrent old generation capacity (KB).
OCCurrent old space capacity (KB).
PGCMNMinimum permanent generation capacity (KB).
PGCMXMaximum Permanent generation capacity (KB).
PGCCurrent Permanent generation capacity (KB).
PCCurrent Permanent space capacity (KB).
YGCNumber of Young generation GC Events.
FGCNumber of Full GC Events.

-gccause Option:Garbage Collection Statistics, Including GC Events

ColumnDescription
LGCCCause of last Garbage Collection.
GCCCause of current Garbage Collection.

前面的字段与gcutil相同.

-gcnew Option:New Generation Statistics

ColumnDescription
S0CCurrent survivor space 0 capacity (KB).
S1CCurrent survivor space 1 capacity (KB).
S0USurvivor space 0 utilization (KB).
S1USurvivor space 1 utilization (KB).
TTTenuring threshold.
MTTMaximum tenuring threshold.
DSSDesired survivor size (KB).
ECCurrent eden space capacity (KB).
EUEden space utilization (KB).
YGCNumber of young generation GC events.
YGCTYoung generation garbage collection time.

-gcnewcapacity Option:New Generation Space Size Statistics

ColumnDescription
NGCMN Minimum new generation capacity (KB).
NGCMXMaximum new generation capacity (KB).
NGCCurrent new generation capacity (KB).
S0CMXMaximum survivor space 0 capacity (KB).
S0CCurrent survivor space 0 capacity (KB).
S1CMXMaximum survivor space 1 capacity (KB).
S1CCurrent survivor space 1 capacity (KB).
ECMXMaximum eden space capacity (KB).
ECCurrent eden space capacity (KB).
YGCNumber of young generation GC events.
FGCNumber of Full GC Events.

-gcold Option:Old and Permanent Generation Statistics

ColumnDescription
PCCurrent permanent space capacity (KB).
PUPermanent space utilization (KB).
OCCurrent old space capacity (KB).
OUold space utilization (KB).
YGCNumber of young generation GC events.
FGCNumber of full GC events.
FGCTFull garbage collection time.
GCTTotal garbage collection time.

-gcoldcapacity Option:Old Generation Statistics

ColumnDescription
OGCMNMinimum old generation capacity (KB).
OGCMXMaximum old generation capacity (KB).
OGCCurrent old generation capacity (KB).
OCCurrent old space capacity (KB).
YGCNumber of young generation GC events.
FGCNumber of full GC events.
FGCTFull garbage collection time.
GCTTotal garbage collection time.

-gcpermcapacity Option: Permanent Generation Statistics

ColumnDescription
PGCMNMinimum permanent generation capacity (KB).
PGCMXMaximum permanent generation capacity (KB).
PGCCurrent permanent generation capacity (KB).
PCCurrent permanent space capacity (KB).
YGCNumber of young generation GC events.
FGCNumber of full GC events.
FGCTFull garbage collection time.
GCTTotal garbage collection time.

-gcutil Option:Summary of Garbage Collection Statistics

ColumnDescription
S0Survivor space 0 utilization as a percentage of the space's current capacity.
S1Survivor space 1 utilization as a percentage of the space's current capacity.
EEden space utilization as a percentage of the space's current capacity.
OOld space utilization as a percentage of the space's current capacity.
PPermanent space utilization as a percentage of the space's current capacity.
YGCNumber of young generation GC events.
YGCTYoung generation garbage collection time.
FGCNumber of full GC events.
FGCTFull garbage collection time.
GCTTotal garbage collection time.

-printcompilation Option: HotSpot Compiler Method Statistics

ColumnDescription
CompiledNumber of compilation tasks performed.
SizeNumber of bytes of bytecode for the method.
TypeCompilation type.
MethodClass name and method name identifying the compiled method. Class name uses "/" instead of "." as namespace separator. Method name is the method within the given class. The format for these two fields is consistent with the HotSpot - XX:+PrintComplation option.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值