-
Notifications
You must be signed in to change notification settings - Fork 373
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
[PROF-8632] Ruby heap size profiling PoC #3261
[PROF-8632] Ruby heap size profiling PoC #3261
Conversation
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.
Gave it a pass, looks sane! ;)
if (heap_recorder->enable_heap_size_profiling) { | ||
// To get an accurate object size, we need to query our tracked live objects so lets iterate over the object_records | ||
st_foreach(heap_recorder->object_records, st_object_records_iterate, (st_data_t) &internal_iteration_data); | ||
} else { | ||
// If we're just reporting heap counts/samples, it's faster to iterate on the heap records | ||
st_foreach(heap_recorder->heap_records, st_heap_records_iterate, (st_data_t) &internal_iteration_data); | ||
} |
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.
Uh, this is interesting -- may be worth calling out as an intro comment in the design of the heap recorder at some point.
ENFORCE_BOOLEAN(cpu_time_enabled); | ||
ENFORCE_BOOLEAN(alloc_samples_enabled); | ||
ENFORCE_BOOLEAN(heap_samples_enabled); | ||
|
||
struct stack_recorder_state *state; | ||
TypedData_Get_Struct(recorder_instance, struct stack_recorder_state, &stack_recorder_typed_data, state); | ||
|
||
state->heap_recorder = heap_recorder_init(); | ||
state->heap_recorder = heap_recorder_init(heap_size_enabled == Qtrue); |
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.
Minor: Don't forget the ENFORCE_BOOLEAN
, to avoid typing accidents ;)
Also, perhaps we should raise if heap_samples_enabled == false
but heap_size_enabled == true
2a11d34
to
564543c
Compare
Replaced with more production-ready versions starting from #3281 |
What does this PR do?
Build on top of #3246 by adding a new profile type capturing the weighted heap size of all live sampled objects in the heap.
Motivation:
Tracking the number of living objects alone does not give us an idea of resource (in this case, memory) utilisation. To understand how close we are to hitting limits and OOMing, we need to understand the cumulative size of things in heap.
Additional Notes:
How to test the change?
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!