You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/04/22 05:52:47 UTC
[GitHub] [druid] FrankChen021 commented on pull request #12469: JvmMonitor: Handle more generation and collector scenarios.
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org