-
Notifications
You must be signed in to change notification settings - Fork 586
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
perf: optimize SelectMergeProfile #2762
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kolesnikovae
force-pushed
the
feat/flamegraph-from-pprof
branch
from
November 28, 2023 06:01
bfb2e17
to
9009baf
Compare
kolesnikovae
changed the title
WIP: feat: pprof in SelectMergeStacktraces
feat: use pprof in SelectMergeStacktraces
Nov 28, 2023
kolesnikovae
changed the title
feat: use pprof in SelectMergeStacktraces
perf: optimize SelectMergeProfile
Nov 29, 2023
cyriltovena
approved these changes
Nov 30, 2023
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.
LGTM
aleks-p
approved these changes
Nov 30, 2023
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.
LGTM as well! I left a few low priority questions / comments.
kolesnikovae
force-pushed
the
feat/flamegraph-from-pprof
branch
from
December 1, 2023 03:35
acdca08
to
ccc59b1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The PR:
SelectMergeProfile
andSelectMergeStacktrace
handlers.SelectMergeProfile
(skips filtering).SelectMergeProfile
.max_node
parameter added toSelectMergeProfile
).My initial goal was to optimize
SelectMergeProfile
and use it instead ofSelectMergeStacktraces
in order to get location information (such as line number, file name, etc) in the flamegraph.However, this does not seem possible due to the vast overhead pprof brings: while a tree / famegraph has compression ratio 10 (gzip), with pprof we can barely expect compression ratio 2. This makes it virtually impossible to switch to pprof without a performance degradation. Moreover, without truncation, we easily hit the default gRPC message size limit (100MB):
Besides, there are certain limitations of the pprof processing flow:
This makes me thinking that we probably first have to introduce "function selector" that allows to scope a flamegraph to a specific location – basically, request a new flamegraph with more details where the selected node is the root (not to confuse with the existing "Focus block" view). This "drill-down" effect will allow us to set a lower
max_nodes
limit (2-4-8K should be fine) as it mitigates the negative impact of truncation.Nevertheless, exporting data in pprof will still be limited to the max message size (on the querier / query-frontend side). I don't think this is a problem, because I know no tools capable of handling this big profiles; but we should probable handle this more gracefully.