From: Joe Conway <mail@joeconway.com>
To: Israel Brewster <ijbrewster@alaska.edu>
Cc: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Properly handle OOM death?
Date: Mon, 13 Mar 2023 15:10:29 -0400
Message-ID: <b9b8d1df-08e2-2863-a2d6-48aec9e457f7@joeconway.com> (raw)
In-Reply-To: <9616AB47-E78B-49FD-81AE-41015E13AADC@alaska.edu>
References: <E1525E23-A751-41C6-AD65-B3BF6C982B06@alaska.edu>
<20230313174301.23n6crb5dpttozup@hjp.at>
<B24D8C1B-E275-4E96-8D35-DFA494ECB0F2@alaska.edu>
<03239776-b0c6-94a8-7bb3-a1af363d745f@joeconway.com>
<9616AB47-E78B-49FD-81AE-41015E13AADC@alaska.edu>
On 3/13/23 14:50, Israel Brewster wrote:
> Looks like V2:
>
> root@novarupta:~# stat -fc %T /sys/fs/cgroup/
> cgroup2fs
Interesting -- it does indeed look like you are using cgroup v2
So the file you want to look at in that case is:
8<-----------
cat
/sys/fs/cgroup/system.slice/system-postgresql.slice/postgresql@14.service/memory.max
4294967296
cat
/sys/fs/cgroup/system.slice/system-postgresql.slice/postgresql@14.service/memory.high
3221225472
8<-----------
If the value comes back as "max" it means no limit is set.
In this example (on my Linux Mint machine with a custom systemd unit
file) I have memory.max set to 4G and memory.high set to 3G.
The value of memory.max determines when the OOM killer will strike. The
value of memory.high will determine when the kernel goes into aggressive
memory reclaim (trying to avoid memory.max and thus an OOM kill).
The corresponding/relevant systemd unit file parameters are:
8<-----------
MemoryAccounting=yes
MemoryHigh=3G
MemoryMax=4G
8<-----------
There are other ways that memory.max may get set, but it seems most
likely that the systemd unit file is doing it (if it is in fact set).
--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: mail@joeconway.com, ijbrewster@alaska.edu, hjp-pgsql@hjp.at
Subject: Re: Properly handle OOM death?
In-Reply-To: <b9b8d1df-08e2-2863-a2d6-48aec9e457f7@joeconway.com>
References: <E1525E23-A751-41C6-AD65-B3BF6C982B06@alaska.edu> <20230313174301.23n6crb5dpttozup@hjp.at> <B24D8C1B-E275-4E96-8D35-DFA494ECB0F2@alaska.edu> <03239776-b0c6-94a8-7bb3-a1af363d745f@joeconway.com> <9616AB47-E78B-49FD-81AE-41015E13AADC@alaska.edu> <b9b8d1df-08e2-2863-a2d6-48aec9e457f7@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox