Decreasing Ram usage

28 views
Skip to first unread message

Thomas Will

unread,
Apr 14, 2020, 6:33:50 AM4/14/20
to Prometheus Users
Hello guys,  I am running my Prometheus in a docker container, have set my retention period to be 2days and also enabled Thanos at the back. I have two questions:-

1) For how much time Prometheus stores its metrics in ram and after that sends to the disc?
2) Is there any way to control our ram usage, like based on size or number of metrics, i.e. if ram size increases beyond a threshold, dump the data to the disc.

Cheers, all.
Thomas Will.

Ben Kochie

unread,
Apr 14, 2020, 6:45:12 AM4/14/20
to Thomas Will, Prometheus Users
Prometheus only keeps up to 2 hours in memory. After this it is always written to disk and mmaped. There are no controls for this. The local retention time makes (almost) no difference to memory use.

The only control is to reduce the metrics collected.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1a166fbc-3c49-45b4-9dec-361f07f20172%40googlegroups.com.

Thomas Will

unread,
Apr 14, 2020, 6:51:26 AM4/14/20
to Prometheus Users
Thank you, Ben, for replying. "by local retention" I am assuming that you are talking about the 2hr retention in ram. How it's not gonna affect the memory use, as we will be storing all the metrics in ram for 2hrs. right?

On Tuesday, April 14, 2020 at 4:15:12 PM UTC+5:30, Ben Kochie wrote:
Prometheus only keeps up to 2 hours in memory. After this it is always written to disk and mmaped. There are no controls for this. The local retention time makes (almost) no difference to memory use.

The only control is to reduce the metrics collected.

On Tue, Apr 14, 2020, 12:33 Thomas Will <thomasw...@gmail.com> wrote:
Hello guys,  I am running my Prometheus in a docker container, have set my retention period to be 2days and also enabled Thanos at the back. I have two questions:-

1) For how much time Prometheus stores its metrics in ram and after that sends to the disc?
2) Is there any way to control our ram usage, like based on size or number of metrics, i.e. if ram size increases beyond a threshold, dump the data to the disc.

Cheers, all.
Thomas Will.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Ben Kochie

unread,
Apr 14, 2020, 7:20:17 AM4/14/20
to Thomas Will, Prometheus Users
Local retention refers to on-disk retention. You said you set this to 2 days. The local disk retention could be 2 days or 15 days, it doesn't contribute significantly to memory use. Only 2 hours are kept in memory.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/c19411f3-6b25-40af-a096-b98938d945f4%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages