How to get heap usage using jstat?

a 夏天 提交于 2019-12-01 08:31:39

问题


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

How to read:

  1. used heap

  2. heap size

  3. max heap

from this output, just like shown by VisualVM?


回答1:


See https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html for general reference.

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")

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

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

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).



来源:https://stackoverflow.com/questions/43735962/how-to-get-heap-usage-using-jstat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!