-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8258414: OldObjectSample events too expensive #2645
Conversation
/label add hotspot-jfr, hotspot |
👋 Welcome back fdavid! A progress list of the required criteria for merging this PR into |
@flodav The |
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.
Ok, kicking off the review.
The implementation is doing the right thing (AFAICT) and I have no strong objections, just minor things regarding slightly more detailed comments.
@@ -281,6 +281,9 @@ bool JfrRecorder::create_components() { | |||
if (!create_stacktrace_repository()) { | |||
return false; | |||
} | |||
if (!create_leak_profiler_stacktrace_repository()) { |
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.
Can you add a comment here explaining the purpose of having a separate leak profiler stacktrace repository?
#include "jfr/leakprofiler/sampling/objectSample.hpp" | ||
#include "jfr/leakprofiler/sampling/objectSampler.hpp" |
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.
Are those 2 extra includes needed?
@@ -197,6 +197,57 @@ static bool stack_trace_precondition(const ObjectSample* sample) { | |||
return sample->has_stack_trace_id() && !sample->is_dead(); | |||
} | |||
|
|||
class StackTraceChunkWriter { |
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.
Perhaps, a detailed comment explaining how this is working with the regular stacktrace writer would be good to have here.
The purpose of this change is to reduce the size of JFR recordings when the OldObjectSample event is enabled.
Problem
JFR recordings size blows up when the OldObjectSample is enabled. The memory allocation events are known to be very high traffic and will cause a lot of data, just the sheer number of events produced, and if stacktraces are added to this, the associated metadata can be huge as well. Sampled object are stored in a priority queue and their associated stack traces stored in JFRStackTraceRepository. When sample candidates are removed from the priority queue, their stacktraces remain in the repository, which will be later written at chunk rotation even if the sample has been removed.
Implementation
This PR adds a JFRStackTraceRepository dedicated to store stack traces for the OldObjectSample event. At chunk rotation, every sample stack trace is looked up in this repository and is serialized. Other stack traces are simply removed.
Benchmarks
On an AWS c5.metal instance (96 cores, 192 Gib), running SPECjvm2008 with default profile.jfc configuration with OldObjectSample event enabled gives:
Progress
Issue
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2645/head:pull/2645
$ git checkout pull/2645