prometheus: Prometheus high memory usage(>960Gib) with 1200+ ServiceMonitors

What did you do?

We have been running a prometheus on one of our large production clusters which emits >5M+ active time series, which is operator managed Prometheus running on 1024Gib machine. However, prometheus keep crashing with OOM very frequently

There are around 1200+ serviceMonitors running with 5mins interval, not sure if this something causing memory leak ?

here is pprof top output: image

Screenshot 2024-02-14 at 6 57 19 PM

Sample labeling for one of the targets:(95% of targets have same set of labels) Screenshot 2024-02-14 at 9 45 21 PM

What did you expect to see?

I feel 1024Gib is quite large to manage 50M+ timeseries

What did you see instead? Under which circumstances?

Memory usage getting spiked to 900Gib+ with in 10-15mins which is unusual

Screenshot 2024-02-14 at 10 00 04 PM

Memory usage based on container_memory_working_set_bytes metric image

System information

No response

Prometheus version

v2.45+stringlabels

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

I note that https://github.com/prometheus/prometheus/pull/13147 changes only the experimental service discovery manager, not the one used here.

You’re right, and I’m only planning to fix https://github.com/prometheus/prometheus/issues/12436 for the “experimental service discovery manager”. I think it’s time that the new manager takes over, besides these fixes, there are a couple of other bugs that only occur on the legacy manager.

I’ll create an issue for the switch to discuss that.