Re: Limiting memory allocation

From: Jan Wieck <jan(at)wi3ck(dot)info>
To: Stephen Frost <sfrost(at)snowman(dot)net>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Limiting memory allocation
Date: 2022-05-17 20:10:31
Message-ID: a4b6b255-1206-7486-ddd2-048606b181ef@wi3ck.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/17/22 15:42, Stephen Frost wrote:
> Thoughts?

Yes.

The main and foremost problem is a server that is used for multiple
services and they behave differently when it comes to memory allocation.
One service just allocates like we have petabytes of RAM, then uses
little of it, while another one is doing precise accounting and uses all
of that. These two types of services don't coexist well on one system
without intervention.

Unfortunately swap space has been shunned as the ugly stepchild of
memory in recent years. It could help in this regard to bring back swap
space, but don't really intend to use it.

Using cgroups one can actually force a certain process (or user, or
service) to use swap if and when that service is using more memory than
it was "expected" to use. So I have a server with 64G of RAM. I give 16G
to Postgres as shared buffers and another 16G to work with. I assume
another 16G of OS buffers, so I restrict the Apache-Tomcat stuff running
on it to something like 8-12G. After that, it has to swap. Of course, my
Postgres processes also will have to swap if they need more than 16G of
overall workmem ... but that is what I actually intended. I may have to
reduce workmem, or max_connections, or something else.

Regards, Jan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2022-05-17 20:12:14 Re: Zstandard support for toast compression
Previous Message Tom Lane 2022-05-17 20:01:07 Re: Zstandard support for toast compression