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