server: import godeltaprof/http/pprof #450
Merged
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 this PR does:
This PR imports
github.com/grafana/pyroscope-go/godeltaprof/http/pprof
in addition tonet/http/pprof
When pyroscope is scraping cumulative profiles (
alloc_{space,objects}
,mutex
,block
) it needs to compute delta (difference / substraction from the previous profile). This is currently happening at grafana-agent after scraping. This requires keeping state of previous profiles requiring much memory and also spends a bunch of cpu time (decompress,deserialize,substract,serialize,compress).godeltaprof is an efficient delta profiler for memory, mutex, and block.
It does compute this delta on the target side instead of the agent side before any compression/serialization, so a lot of work is avoided. Using godeltaprof removes the need to compute the delta on the grafna-agent side - this saves cpu and memory. Also the scraping godeltaprof itself is more efficient compared to scraping net/http/pprof because after delta is computed a lot of samples are rejected and the output profile is much smaller. So it is a win-win for grafana-agent <-> targets. Some benchmarks .
This PR does not change
net/http/pprof
endpoints, just makes the server ready to scrape godeltaprof profiles. Additional changes to scraping configuration is required.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]