Skip to content
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

Prometheus high memory usage,How should i optimize? #1881

Closed
barnettZQG opened this Issue Aug 10, 2016 · 11 comments

Comments

Projects
None yet
6 participants
@barnettZQG
Copy link

barnettZQG commented Aug 10, 2016

Now,my prometheus server manager the exporter of number more than 160,including node-exporter,cAdvisor and mongodb-exporter. scrape them every 5 seconds.
I saw Prometheus resource usage about as follows:
CPU:100% to 1000%(The machine has 10 CPU, 40 CORE)
MEM:90G
The above data is normal?How to optimize them?Because of my monitoring needs to rise to more than 1000 exporter

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Aug 10, 2016

You find documentation about tweaking memory usage here:
https://prometheus.io/docs/operating/storage/#memory-usage

90G seems rather high, but cAdvisor can accumulate quite a lot of metrics,
so not impossible.

On Wed, Aug 10, 2016 at 4:35 AM barnettZQG notifications@github.com wrote:

Now,my prometheus server manager the exporter of number more than
160,including node-exporter,cAdvisor and mongodb-exporter. scrape them
every 5 seconds.
I saw Prometheus resource usage about as follows:
CPU:100% to 1000%(The machine has 10 CPU, 40 CORE)
MEM:90G
The above data is normal?How to optimize them?Because of my monitoring
needs to rise to more than 1000 exporter


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1881, or mute the thread
https://github.com/notifications/unsubscribe-auth/AEuA8lXxzL0A0ao34m1uDRYrGwYasX_gks5qeTkFgaJpZM4Jgtek
.

@barnettZQG

This comment has been minimized.

Copy link
Author

barnettZQG commented Aug 10, 2016

The metrics number of cAdvisor less than node-exporter.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Aug 11, 2016

@barnettZQG Some information about the total number of memory series, ingested samples per second, in-memory chunks, and received queries would be interesting. Could you execute the following queries and tell us the results:

  • rate(prometheus_local_storage_ingested_samples_total[5m])
  • prometheus_local_storage_memory_series
  • prometheus_local_storage_memory_chunks
  • rate(http_request_duration_microseconds_count{handler=~"query|query_range"}[5m])
@barnettZQG

This comment has been minimized.

Copy link
Author

barnettZQG commented Aug 12, 2016

@juliusv
rate(prometheus_local_storage_ingested_samples_total[5m]):100000(avg)
prometheus_local_storage_memory_series: 754439
prometheus_local_storage_memory_chunks:1144916
rate(http_request_duration_microseconds_count{handler=~"query|query_range"}[5m]):query and query_range number is very few

@barnettZQG

This comment has been minimized.

Copy link
Author

barnettZQG commented Aug 15, 2016

@juliusv
The current number of chunks waiting for persistence add more than 1000 per a second,so that more than the local_storage_chunks_to_persist after a period of time.
local_storage_chunks_to_persist:10485760
local_storage_memory_chunks:20971520

I thank is there some problem with IO?

@dobesv

This comment has been minimized.

Copy link

dobesv commented Apr 4, 2018

This link https://prometheus.io/docs/operating/storage/#memory-usage doesn't seem to lead to any information about prometheus memory usage (any more). It just discusses on disk usage.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 5, 2018

@dobesv Good point, the three "Troubleshooting" FAQ items are about Prometheus 1.x, so we should either remove them or clarify that they are about 1.x and qualify the link to point at the versioned docs at https://prometheus.io/docs/prometheus/1.8/storage/#memory-usage

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 5, 2018

I filed a pull request to qualify the version: prometheus/docs#998

@dobesv

This comment has been minimized.

Copy link

dobesv commented Apr 5, 2018

Heh, unfortunately I'm using prometheus 2.0.0 and running out of memory. Where should I look for guidance on understanding and managing memory consumption ?

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 6, 2018

I'm not sure that there's already a doc about 2.x memory consumption anywhere.

@fabxc or @gouthamve can probably give the best explanation, but according to my understanding:

  • The TSDB head block holds the last 2-3h of all series directly in memory (in normal Go datastructures). The usage there is proportional to the number of concurrently active series you have, and also to the sample ingestion rate. Not sure what the memory bytes/sample or bytes/series roughly is for Prometheus 2.x head blocks.
  • Older data blocks are mmaped from disk, so the OS has more control here over what data to page in/out based on memory pressure, so there's more elasticity there.
  • Queries, ingestion, remote write, and other features also use up memory, but I also don't have any good rule-of-thumb guidelines for estimation around those. Especially query memory usage will depend a lot on the type of query, what data it selects, etc.
@lock

This comment has been minimized.

Copy link

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 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.
You can’t perform that action at this time.