Skip to content
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

Open
edbratt opened this issue Nov 26, 2024 · 3 comments
Open

Evaluate adding metrics for virtual threads #9533

edbratt opened this issue Nov 26, 2024 · 3 comments

Comments

@edbratt
Copy link
Member

edbratt commented Nov 26, 2024

Environment Details

  • Helidon Version: 4.1.4
  • Helidon SE and MP
  • JDK version: 21+
  • OS: all
  • Docker version (if applicable): n/a

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.

@edbratt
Copy link
Member Author

edbratt commented Nov 26, 2024

It looks like Loom EA builds include jcmd <pid> Thread.vthread_summary that prints a summary of the scheduler, timers, and I/O pollers. While this is evolving, we might want to look at this. More at https://bugs.openjdk.org/browse/JDK-8339420

@tjquinno
Copy link
Member

Another possibility would be for Helidon to add a JFR RecordingStream implementation which works with RecordingEvent instances describing events related to virtual threads (start, stop, pin).

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 RecordingStreams can register events they are interested by name. Although this would obviously be additional work for us initially it might nice for users and could be a way for us to avoid having to respond to a series of subsequent requests to add support for particular other events.

@vasanth-bhat
Copy link

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 Event

jdk.VirtualThreadPinned

Instant Events

jdk.VirtualThreadStart
jdk.VirtualThreadEnd
jdk.VirtualThreadSubmitFailed

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:
java.util.concurrent.ForkJoinPool@6ef19360[Running, parallelism = 14, size = 14, active = 4, running = 0, steals = 14531357, tasks = 0, submissions = 0]

This is a critical information , and need to be available as Metric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

3 participants