Monitoring Java Safepoint Time in JDK16+
David Holmes
david.holmes at oracle.com
Thu Jun 17 01:39:56 UTC 2021
Hi Carter,
On 17/06/2021 5:12 am, Carter Kozak wrote:
> As java 16 and beyond lock down access to internal components by default, it can be difficult to produce Prometheus-style metrics describing application safepoints. I’ve been monitoring these metrics so that I can be alerted when an application spends more than ~10% of time in safepoints for some duration, because it means that something has gone wrong: Most often GC spirals, however excessive thread dumps, deadlock checks, etc can contribute. This has been one of the most meaningful tools in my arsenal to detect general JVM badness, however there doesn’t seem to be a way to access the data in newer JREs without allowing access to internal components.
>
> Previously I was able to use something along these lines, which required legacy sun.management component access.
>
> sun.management.HotspotRuntimeMBean hotspotRuntimeManagementBean = sun.management.ManagementFactoryHelper.getHotspotRuntimeMBean();
> long totalSafepointTimeMillis = hotspotRuntimeManagementBean.getTotalSafepointTime();
In what way does this no longer work? We have a test in
jdk/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java that
uses this API and doesn't seem to need to do anything to allow access. ??
Cheers,
David
-----
> Before I get ahead of myself, I’d like to confirm that I haven’t missed a supported pathway to access safepoint time. If my read is correct and there’s no way to access this information from inside the running JVM, would it be a a reasonable addition to the public API?
>
> Thanks,
> Carter Kozak
>
More information about the serviceability-dev
mailing list