-
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-8667] Heap Profiling - Part 3 - Snapshot system #3328
Conversation
0eed56c
to
a86fccc
Compare
a8357de
to
12c22c5
Compare
a86fccc
to
15278a3
Compare
[PROF-8667] Some comments and location fixes. [PROF-8667] Fix typo and enable 'records live heap objects' test. [PROF-8667] Heap Profiling - Part 2 - Live Tracking [PROF-8667] Remove one remaining usage of sum. [PROF-8667] Address comments
12c22c5
to
051c803
Compare
bac32b4
to
8577e49
Compare
171a265
to
774c96a
Compare
8577e49
to
fb50bbd
Compare
e9c26ce
to
ed57a26
Compare
fb50bbd
to
6674f5c
Compare
[PROF-8667] Update comment
6674f5c
to
ef2dfbf
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3328 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 1253 1253
Lines 72998 73020 +22
Branches 3427 3429 +2
=======================================
+ Hits 71712 71734 +22
Misses 1286 1286 ☔ View full report in Codecov by Sentry. |
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.
Here sir, take my 👍 . I've left a few notes on how I don't quite think this is the way to go, but leave the decision in your hands :)
…ids' into alexjf/prof-8667-heap-profiling-part3-queue
…ids' into alexjf/prof-8667-heap-profiling-part3-queue
0e72b55
to
01cb735
Compare
83c429b
to
b8bb16e
Compare
b8bb16e
to
a598746
Compare
47dd4f4
to
d73978d
Compare
643ee92
to
d58e2f1
Compare
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.
Some last-minute notes from a last pass I did yesterday.
What does this PR do?
This PR follows #3287 and reduces the conflict of serialization and sampling which was forcing us to potentially drop some allocation samples on the floor.
How does it work?
Initially the assumption was that sampling and serialization operated on the same structures and thus needed to be protected by a mutex. Due to us never wanting to delay sampling code, we had noted the need for a queueing system to not be forced to drop data on the floor. This was the only realistic implementation back when we were relying on free tracepoints which could invalidate object_records at any point in time.
@ivoanjo noted that:
st_copy
operations seem to be extremely efficient, requiring at most 2 mallocs and 2 memcpy.heap_recorder_prepare_iteration
,heap_recorder_for_each_live_object
andheap_recorder_finish_iteration
(since they all run from the same serialization thread and we have only one such thread).Given the above, we can trivially do a copy/snapshot of
object_records
duringheap_recorder_prepare_iteration
and have the actual iteration operate on that snapshot without ever conflicting with any concurrent sampling that might happen in-between (object_records_snapshot
is read-only after construction, mutations will only be recorded inobject_records
during any sampling that happens concurrently with serialization).Motivation:
Never wanting to block the allocation tracepoint and not wanting to drop relevant samples on the floor.
Additional Notes:
How to test the change?
It's quite hard to manually or deterministically trigger the conditions whereupon serialization could conflict with sampling and which justified this entire endeavour. Hopefully the fact that all existing specs plus the new "long serialization simulation" specs can provide enough assurance?
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!