FrankChen021 commented on PR #12469:
URL: https://github.com/apache/druid/pull/12469#issuecomment-1106035800

   I notice that we're using the JStatData APIs provided in the 
`org.gridkit.lab` dependency to get metrics of GC. And this lib requires an 
additional JVM argument `--add-exports=java.base/jdk.internal.perf=ALL-UNNAMED` 
to enable the counters because it uses the APIs inside the tools.jar to get the 
counters.
   
   The JDC itself provides public management API to allow us to access these 
counters. 
   
   - For GC metrics, we can use `java.lang.management.GarbageCollectorMXBean` 
to get the metrics. Here's a reference implementation from my personal repo: 
https://github.com/FrankChen021/bithon/blob/master/agent/agent-plugins/jvm/src/main/java/org/bithon/agent/plugin/jvm/gc/GcMetricCollector.java
   
   - For the GC memory spaces, we can use the 
`ManagementFactory.getMemoryPoolMXBeans()` to get the objects that hold the 
memory size of different GC memory spaces.
   
   I think we can use these APIs to replace the old one so that we:
   - can drop the additional JVM argument requirement on JDK 11 and above
   - don't need to change our code to adapt the collector and space names.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to