Re: Properly handle OOM death? - Mailing list pgsql-general

From Jeffrey Walton
Subject Re: Properly handle OOM death?
Date
Msg-id CAH8yC8=+6-GkfgWe3j7Bn-7r-0gXhsNkW7xKkoLVgVjnitbY9w@mail.gmail.com
Whole thread Raw
In response to Re: Properly handle OOM death?  (Tomas Pospisek <tpo2@sourcepole.ch>)
List pgsql-general
On Sat, Mar 18, 2023 at 6:02 PM Tomas Pospisek <tpo2@sourcepole.ch> wrote:
>
> On 13.03.23 21:25, Joe Conway wrote:
>
> > Hmm, well big +1 for having swap turned on, but I recommend setting
> > "vm.overcommit_memory=2" even so.
>
> I've snipped out the context here, since my advice is very unspecific:
> do use swap only as a safety net. Once your system starts swapping
> performance goes down the toilet.

To use swap as a safety net, set swappiness to a low value, like 2.
Two will keep most data in RAM and reduce (but not eliminate) spilling
to the file system.

I have a bunch of old ARM dev boards that are resource constrained.
They use SDcards, which have a limited lifetime based on writes. I
give the boards a 1 GB swap file to avoid OOM kills when running the
compiler on C++ programs. And I configure them with a swappiness of 2
to reduce swapping.

Jeff



pgsql-general by date:

Previous
From: Tomas Pospisek
Date:
Subject: Re: Properly handle OOM death?
Next
From: shashidhar Reddy
Date:
Subject: Re: Getting error while upgrading postgres from version 12 to 13