Re: Limiting memory allocation - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Limiting memory allocation
Date
Msg-id 1ed0c046-14a5-337d-c157-a440d1ae3707@joeconway.com
Whole thread Raw
In response to Re: Limiting memory allocation  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Limiting memory allocation
List pgsql-hackers
On 5/18/22 11:11, Alvaro Herrera wrote:
> Now that's where cgroup's memory limiting features would prove useful,
> if they weren't totally braindead:
> https://www.kernel.org/doc/Documentation/cgroup-v2.txt
> Apparently, if the cgroup goes over the "high" limit, the processes are
> *throttled*.  Then if the group goes over the "max" limit, OOM-killer is
> invoked.
> 
> (I can't see any way to make this even more counterproductive to the
> database use case.  Making the database work more slowly doesn't fix
> anything.)

You may be misinterpreting "throttle" in this context. From [1]:

   The memory.high boundary on the other hand can be set
   much more conservatively. When hit, it throttles
   allocations by forcing them into direct reclaim to
   work off the excess, but it never invokes the OOM
   killer.

> So ditch cgroups.

You cannot ditch cgroups if you are running in a container. And in fact 
most non-container installations these days are also running in a cgroup 
under systemd.

The only difference is that you are more likely to see a memory limit 
set in a container than under systemd.

[1] 
https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/cgroup-v2.rst

-- 
Joe Conway
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Zstandard support for toast compression
Next
From: Andres Freund
Date:
Subject: Re: [RFC] building postgres with meson -v8