[PROF-9476] Managed string storage for interning over several profiles #414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
PoC for allowing string interning to survive across several profiles. This is used in DataDog/dd-trace-rb#3628 to reduce the overhead of heap profiling.
THIS CODE IS NOT PRODUCTION READY AND IS SIMPLY A HACKISH PoC!
Motivation
Heap profiling is a stateful mode of profiling where samples associated with live objects may be emitted across several profiles (those where the live object stays alive). Because of this, information such as the allocation class and allocation stacktrace needs to be preserved alongside the tracked object so heap samples can be re-inserted in subsequent profiles.
libdatadog already does a good job of handling and deduplicating strings in the span of a single profile. Exposing an API to allow doing this work across several profiles would prevent users from having to re-implement this outside of libdatadog and duplicating a lot of work.
Initial testing with dd-trace-rb shows great promise, allowing us to increase heap sampling rate by 10x with negligible overhead compared to the currently released implementation:
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.
For Reviewers
@DataDog/security-design-and-guidance
.