You have installed the Prometheus OpenMetrics integration for Docker or Kubernetes, and it consumes too much memory or CPU.
When running the integration in a huge cluster scraping hundreds of targets, CPU and memory consumption will increase, and the number of workers could affect
For example, a Prometheus OpenMetrics integration consumes 2.5 CPU and 700Mb of RAM because:
- It scrapes
800 targets, exposing
- Each one has a latency of
scrape_durationof 30 seconds.
To reduce resource consumption:
Update the integration to the latest available image.
Reduce harvest time by lowering
emitter_harvest_period. (The default value is
1s, and the interval cannot be smaller than
200ms.) Since metrics are sent more often, memory consumption is reduced.
Collect metrics less frequently by increasing
scrape_durationto reduce both memory consumption and CPU usage.
Reduce the number of workers to reduce both memory consumption and CPU usage. Scraping will slow down and could exceed
scrape_duration.To do so:
- Update the integration to the latest version available of the image.
worker_threadsfrom the default value of
4to your preferred value.