-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate adding metrics for virtual threads #9533
Comments
It looks like Loom EA builds include |
Another possibility would be for Helidon to add a JFR We'd need to do some investigation to understand whether these are instance or duration events, what users would need to do to get this information (would there be a separate component users would add or would this be part of the current system-provided metrics component), etc. It might also be feasible to allow users to configure which JRF events Helidon would publish as metrics, as |
Based on what we have seen , below JFR events are supported for Virtual Threads. Three of them are Instant and 1 of them is duration. Duration Eventjdk.VirtualThreadPinned Instant Eventsjdk.VirtualThreadStart But none of them give info on current carrier thread statistics, which is available from "Thread.vthread_summary" or. "Thread.vthread_scheduler" Sample output : Default virtual thread scheduler: This is a critical information , and need to be available as Metric |
Let me highlight some important points.
It would be great if the JDK provided an efficient way to get this information so Helidon could capture it in metrics. I am not aware of an efficient way to do that, but if there is one I would like to learn of it. |
Virtual threads model tasks and are designed to scale into the millions. What would it mean to have metrics for such things, I wonder? |
Minor correction. The ForkJoinPool is used to implement Carrier Thread pool , which is used to execute the virtual threads. Yes, it's default implementation and. there may be ways to have alternate implementation
There is indeed an API available in Java-24 to get this information on carrier threads from Virtual Thread Scheduler. |
Even better, much more straightforward, and the JDK owns any compatibility issues if the underlying implementation changes at some point. My very quick web searching didn't turn up the As you might know, accessing MXBeans is how Helidon already exposes various JVM values as metrics. The values exposed by Obviously this would require JDK 24 to work. Helidon 4.x has to work with JDK 21 (or later). For a number of reasons we try to avoid dynamic class searching (e.g. There might be some other options, though. I need to experiment a bit with those but if I find anything useful I'll share it here. |
Environment Details
This enhancement request is for tracking generation of additional metrics that will provide Helidon users information about virtual thread usage. As an example, current metrics provided in JVM include a count of active Platform Threads. Helidon users would like a metric that provides similar count of active of in-flight virtual threads. Users might also benefit from a runnig tally of current pinned threads.
The text was updated successfully, but these errors were encountered: