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 upKubernetes: Memory usage continually increases. Process enters crash recovery loop. #1885
Comments
This comment has been minimized.
This comment has been minimized.
|
3 million series is quite a bit and the memory usage corresponds to what I recall from production clusters. @beorn7 do the calculation in the docs have to be adjusted? At this scale I doubt that you want to keep all of these millions of time series around for weeks, but rather the meaningful aggregates that you are interested in for a longer time. Especially as you might want to scale up even further, you should probably think about starting a sharded setup. In the beginning this could just mean running one scraping Prometheus server at a retention of about 12h (or however long you are interested in ALL individuall time series). And letting it calculate a set of recording rules that give you meaningful time series. You can then run a second Prometheus server federating these aggregates and storing them for a longer time. This one will likely end up having at least 100x fewer time series. If one scraping Prometheus server even gets too large for short-term ingestion and aggregation, you can then scale it out into several actual shards using the I hope this gives you a rough idea. Brian also wrote something on it in his blog: http://www.robustperception.io/scaling-and-federating-prometheus/ In the future, we'd of course aim for a storage, that handles memory more gracefully and has less tendency for OOMing. |
This comment has been minimized.
This comment has been minimized.
|
Also thanks for the detailed issue. Very much appreciated. |
fabxc
added
the
kind/question
label
Aug 15, 2016
This comment has been minimized.
This comment has been minimized.
Given the various reports we got, we should consider a more elaborate formula, something like This needed some studying to get a and b right. It would also help on our way to come up with some automated management of memory consumption eventually, cf. #455 . |
This comment has been minimized.
This comment has been minimized.
|
Something I've thought about for a few times: we could start anonymously On Mon, Aug 15, 2016 at 6:47 AM Björn Rabenstein notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
Closing here as the original cause is well known and tracked and not specific to Kubernetes. |
fabxc
closed this
Sep 5, 2016
This comment has been minimized.
This comment has been minimized.
|
For what it's worth, I've federated my setup. At around 2MM metrics being scraped with a retention of 12hours, and 20Gi of RAM reserved for the prometheus process, I still experience the process being OOM killed, then killed repeatedly on recovery at around 2.1MM metrics. I understand I must need more RAM, but I was under the impression (from the documentation) that 3 * the number of series for active chunks, then 3 * the number of chunks for total RAM usage would give me a reasonable first approximation. This doesn't appear to be the case. It is still completely opaque to me how to even ballpark how much RAM is required for 2MM series. 64G? 128G? |
This comment has been minimized.
This comment has been minimized.
|
@fluxrad Usually, the most important parameter is net the number of time series, but the number of configured memory chunks (albeit the latter is recommended to be at least 3x of the former). The number from the docs of 3x the number of 1k chunks is a rule-of-thumb minimum. At SoundCloud, our "save default" is 6x, i.e. on a 64GiB machine, we configure ~10M memory chunks (which in turn is good for up to ~3M time series). |
This comment has been minimized.
This comment has been minimized.
bretep
commented
Apr 17, 2017
•
|
@fabxc, where is this well known issue being tracked? Can you link to an issue? |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 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. |
fluxrad commentedAug 11, 2016
Summary
3 million series appear to exhaust memory on a 32GB m4.2xlarge
I'm attempting to use Prometheus to monitor a 68 node kubernetes cluster, with node-exporter and kubernetes scrape configs. When I scrape container-level metrics from the
noderole, I notice that the number of series begins to approach ~3 million around 24 hours. At this point, the process is killed by the kernel with an OOM error. Prometheus is running on a 32GB (AWS: m4.2xlarge) machine with no resource limits:After approximately 24 hours, the kernel OOM kills the prometheus docker process, at which point the docker container enters a crash loop trying to recover metrics.
The only recovery mechanism from here is to clear storage and restart prometheus. Both
storage.local.memory-chunksandstorage.local.max-chunks-to-persistflags seem to have no impact on how quickly the process runs out of memory, or how much memory prometheus consumes overall.By my calculations 3 million series should consume somewhere between 6-9 million chunks in memory, or 6-9GB. Assuming overhead for queries and general memory consumption, memory usage should still be well under the 32GB provided by the machine. Is this assumption accurate? If so, where is the rest of the memory going? I've mitigated the issue by dropping all container-level metrics from kubernetes node scrapes.
Prometheus memory-hungry config:
Host information
We do perform a number of production deploys per day, which I expect will contribute significantly to unique time-series metrics coming from the hosts themselves as containers come and go. Even so, I'd expect to be able to handle a week's worth of metrics.
At this point, I'm uncertain how to tell whether or not we have a configuration issue, or whether or not 3 million series simply won't fit onto a 32GB machine. I'm hoping someone can advise.
Thanks very much for your help.