-
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
Add metrics related to virtual threads #9619
Conversation
Some general questions @tjquinno ...
Is there also a counter for platform threads?
Under what conditions would this counter be incremented? |
...system-meters/src/main/java/io/helidon/metrics/systemmeters/VThreadSystemMetersProvider.java
Show resolved
Hide resolved
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright (c) 2023 Oracle and/or its affiliates. | |||
* Copyright (c) 2023, 2024 Oracle and/or its affiliates. | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a copyright update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a remnant from an earlier iteration of the change I was contemplating. Not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. File no longer in the changed list.
...system-meters/src/main/java/io/helidon/metrics/systemmeters/VThreadSystemMetersProvider.java
Show resolved
Hide resolved
The existing Helidon built-in meters created in `SystemMetersProvider.java include some platform-thread related ones:
This JMX MBean makes a number of other thread-related values available: Probably the most useful value that's available we don't currently expose is the total started thread count. We could add that.
I don't have an interesting example of the value. Here is an example of the output, taken from the updated doc that's part of this PR (obviously with no interesting output): "vthreads.recentPinned": {
"count": 0,
"max": 0.0,
"mean": 0.0,
"total": 0.0,
"p0.5": 0.0,
"p0.75": 0.0,
"p0.95": 0.0,
"p0.98": 0.0,
"p0.99": 0.0,
"p0.999": 0.0
},
Here's what the Java Flight Recorded doc says about the value it reports about pinned virtual threads.
See the previous link. |
…e file unchanged except for copyright date
67800cc
to
8040b24
Compare
The latest push accomplished:
|
…ecause the virtual threads recentPinned meter is now a timer
Description
Resolves #9533
New meters related to virtual thread usage
The virtual thread count meters are disabled by default for performance reasons. Enable them by setting
metrics.virtual-threads.count.enabled=true
in configuration, but be aware doing so can degrade the server's performance.New meter related to platform threads
Helidon also now exposes the new system meter
thread.starts
which displays the total number of platform thread starts performed in the JVM since server start-up.The PR adds a new
MetersProvider
implementation to thehelidon-metrics-system-meters
component. The new implementation registers for selected Java Flight Recorder events to track data related to virtual threads.The three virtual thread meters that are enabled by default should be rare so monitoring the JFR events for them adds very little overhead. In contrast, to maintain the current number of active virtual threads and the total number of virtual thread starts the added code must register for and respond to virtual thread start and end events which can be costly. That's why those two meters--and the registration of listeners for those events from JFR--are disabled by default.
Documentation
Small additions to the SE and MP metrics guide and doc pages.