如何使用jstat获取堆使用情况? [英] How to get heap usage using jstat?

查看:109
本文介绍了如何使用jstat获取堆使用情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行jstat -gc(来自OpenJDK):

I'm running jstat -gc (from OpenJDK):

# jstat -gc 1
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT
287744.0 290304.0 88368.6  0.0   1469440.0 787186.5 2162176.0  1805969.7  945432.0 923880.4 136576.0 133284.0    268   32.797  21     30.089   62.886

阅读方法:

  1. 二手堆

  1. used heap

堆大小

最大堆

从此输出,就像VisualVM所示吗?

from this output, just like shown by VisualVM?

推荐答案

请参见 https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html 作为一般参考.

当前堆大小将是所有以"C"结尾的字段的总和-S0C,S1C,EC,OC(Metaspace除外,该字段以"M"开头)

Current heap size would be the sum of all the fields that end with "C" - S0C, S1C, EC, OC (except for Metaspace which is the fields that start with "M")

使用的堆将是所有以"U"结尾的字段的总和-S0U,S1U,EU,OU(同样,元空间除外).

Used heap would be the sum of all the fields that end with "U" - S0U, S1U, EU, OU (again, except metaspace).

请注意,"C"值(当前)大于或等于"U"值(实际使用).

Note that the "C" values (current) are greater than or equal to "U" values (actually used).

要获取最大值,请使用-gccapacity标志运行jstat并添加所有以"MX"结尾的字段(NGCMX,OGCMX,...,元空间MCMX除外).

To get maximum values run jstat with the -gccapacity flag and add up all the fields that end with "MX" (NGCMX, OGCMX, ... except for MCMX which is metaspace).

这篇关于如何使用jstat获取堆使用情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆