collector: reduce filesystem and textfile allocations#3631
Open
kevinburke wants to merge 1 commit intoprometheus:masterfrom
Open
collector: reduce filesystem and textfile allocations#3631kevinburke wants to merge 1 commit intoprometheus:masterfrom
kevinburke wants to merge 1 commit intoprometheus:masterfrom
Conversation
Store filesystem read-only state during mount parsing instead of
serializing and reparsing mount options on every scrape. Rework
textfile metric family conversion to build one desc per family and
normalize label sets by index.
Benchstat:
goos: linux
goarch: amd64
pkg: github.com/prometheus/node_exporter/collector
cpu: AMD Ryzen 9 8945HS w/ Radeon 780M Graphics
│ /tmp/base.txt │ /tmp/current.txt │
│ sec/op │ sec/op vs base │
ParseFilesystemLabels-8 219.78µ ± 0% 98.89µ ± 1% -55.01% (p=0.000 n=20)
TextfileConvertMetricFamily-8 466.0µ ± 1% 223.5µ ± 1% -52.04% (p=0.000 n=20)
geomean 320.0µ 148.7µ -53.55%
│ /tmp/base.txt │ /tmp/current.txt │
│ B/op │ B/op vs base │
ParseFilesystemLabels-8 191.29Ki ± 0% 99.28Ki ± 0% -48.10% (p=0.000 n=20)
TextfileConvertMetricFamily-8 472.0Ki ± 0% 292.8Ki ± 0% -37.95% (p=0.000 n=20)
geomean 300.5Ki 170.5Ki -43.25%
│ /tmp/base.txt │ /tmp/current.txt │
│ allocs/op │ allocs/op vs base │
ParseFilesystemLabels-8 4.169k ± 0% 1.097k ± 0% -73.69% (p=0.000 n=20)
TextfileConvertMetricFamily-8 13.054k ± 0% 7.955k ± 0% -39.06% (p=0.000 n=20)
geomean 7.377k 2.954k -59.96%
Signed-off-by: Kevin Burke <kevin@burke.dev>
248334e to
231cb5d
Compare
1 task
|
We're noticing that on GKE sometimes each scrape takes like, 20-30s, and readonly errors seem to be the primary difference vs our EKS clusters (which are faster). Are you experiencing something like that kinda slowdown? |
Member
|
Mount options can change between scrapes. This would cache this value permanently. We need to parse every scrape to find out if someone ran |
This file contains hidden or 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
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.
Store filesystem read-only state during mount parsing instead of serializing and reparsing mount options on every scrape. Rework textfile metric family conversion to build one desc per family and normalize label sets by index.