eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 721 forks source link

Implement jstat -gc #10558

Open Sir-Will opened 4 years ago

Sir-Will commented 4 years ago

Hello,

It would be great if OpenJ9 had a command like hotspot has jstat -gc which allows retrieving information like heap usage and GC time of a specified process.

For hotspot, I'm using munin plugins linked below to monitor the java processes, unfortunately I'm not able to find a way to do that with OpenJ9. https://github.com/munin-monitoring/contrib/tree/master/plugins/jvm

JasonFengJ9 commented 4 years ago

Will investigate and see what info OpenJ9 can provide via jstat -gc?

JasonFengJ9 commented 4 years ago

As per [1], RI jstat -gc displays statistics about the behavior of the garbage collected heap with following output columns:

S0C: Current survivor space 0 capacity (KB).
S1C: Current survivor space 1 capacity (KB)
S0U: Survivor space 0 utilization (KB).
S1U: Survivor space 1 utilization (KB).
EC: Current eden space capacity (KB).
EU: Eden space utilization (KB).
OC: Current old space capacity (KB).
OU: Old space utilization (KB).
MC: Metaspace Committed Size (KB).
MU: Metaspace utilization (KB).
CCSC: Compressed class committed size (KB).
CCSU: Compressed class space used (KB).
YGC: Number of young generation garbage collection (GC) events.
YGCT: Young generation garbage collection time.
FGC: Number of full GC events.
FGCT: Full garbage collection time.
GCT: Total garbage collection time.

@dmitripivkine does OpenJ9 GC have similar statistic data available?

[1] https://docs.oracle.com/en/java/javase/14/docs/specs/man/jstat.html

dmitripivkine commented 4 years ago

Most of this information is around. Currently it can be found in GC verbose logs (per GC basis). Summary can be seen as report in GCMV (terminology can be different). The only part is not there is Metaspace and Class space information. These parts of information can be discovered in javacore in NATIVEMEMINFO subcomponent dump routine section

dmitripivkine commented 4 years ago

Ok, this is existing run-time utility required to be extended to report more data. The work required in GC part is review current stats info stored already and add/maintain new fields if necessary to be ready to report run-time. We should investigate which parts of native memory allocations should be included to report as Metadata space (something else except GC Metadata?) On VM/Tools side an utility should be updated to add GC related information to report @amicic FYI

tejas558 commented 2 years ago

Hi, I'm completely new to open source and would like to try this. How do I start and what should I do to solve this?

JasonFengJ9 commented 2 years ago

@ttorpy welcome to OpenJ9, a start point is openj9/tools/attach/diagnostics/tools/Jstat.java

OpenJ9 build instructions - https://github.com/eclipse-openj9/openj9/tree/master/doc/build-instructions

raiyansayeed commented 2 years ago

@ttorpy are you still working on this? Is there any way I can help if you still are?

Staszek1062 commented 2 years ago

@ttorpy same question bud

tejas558 commented 2 years ago

Hi, I'm sorry I am not working on this anymore. I think this was way above my skill level.