Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPrometheus server high CPU usage for Label sorting #3944
Comments
This comment has been minimized.
This comment has been minimized.
|
Can you try with a newer version of Prometheus? You're probably hitting an issue with SD that was fixed. |
This comment has been minimized.
This comment has been minimized.
|
Just bumped to 2.2.0. Node doesn't appear at all. Thanks for the quick response! Glad sorting wasn't actually a bottleneck. |
mxork
closed this
Mar 9, 2018
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
lock
bot
locked and limited conversation to collaborators
Mar 22, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
mxork commentedMar 9, 2018
•
edited
Using prometheus as monitor on kubernetes cluster. ~100
node_exporters, ~300 targets total. Runninggo tool pprof --gif $server/debug/pprof/profile > prof.gifshows high CPU usage for sorting Labels.We're running prometheus as a fairly by-the-books kubernetes custom-metrics-apiserver, using k8s-prometheus-adapter.
The code (https://github.com/prometheus/prometheus/blob/master/pkg/labels/labels.go) seems to have two reasons for running slowly: one is passing through
Sortinterface, the other is the repeated comparison of strings with a possibly shared prefix. Using labels to represent paths in a hierarchy seems like a reasonable use case, and shouldn't lead to poor performance. If anyone has a one-liner to generate the list of labels being operated on, I can dump them.If my diagnosis is correct, there are low-hanging solutions. One is to go:generate a sort procedure which does not pass through the interface barrier (several generators are floating around). This is simplest, but does not address the shared-prefix problem. Two is to implement a trie-sort, which does.
System information:
Centos 7.4
Linux 3.10.0-693.11.6.el7.x86_64 x86_64
Prometheus version:
2.1.0
Prometheus configuration file: