Re: Out of Memory - Mailing list pgsql-general

From Christoph Moench-Tegeder
Subject Re: Out of Memory
Date
Msg-id 20180927063039.n5ea4xuefxtrbusa@squirrel.exwg.net
Whole thread Raw
In response to Re: Out of Memory  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Out of Memory  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
## Laurenz Albe (laurenz.albe@cybertec.at):

> vm.overcommit_memory = 2
> vm_overcommit_ratio = 100
> 
> Linux commits (swap * overcommit_ratio * RAM / 100),
                      ^
                      That should be a "+".

See Documentation/sysctl/vm.txt and Documentation/vm/overcommit-accounting.rst
in your kernel tree.

> so without any swap the correct value would be 100.
> 
> I don't know how safe it is to got entirely without swap.

That's completely safe. Even more: if your production machine ever needs
swap, it's already mostly dead in the water. So there's also no benefit in
having the kernel copy stuff to swap "just in case" (read: set sysctl
vm.swappiness to 0) and use the swap disk space for something more
productive. If your memory usage ever exceeds available memory, something
already went horribly wrong, and you want to know about it right now.
A good way to know about this kind of mistakes is having stuff fail
hard, obviously and loudly (i.e. Out Of Memory). Do not try to save
some day by swapping: stuff is "sometimes slow" and if you really need
the swap, everything crawls to a halt anyway.
Of course, this does not hold for personal workstations and
the like where you might want to use the swap space for suspend to
disk, or have some buffer in case of runaway processes.

Regards,
Christoph

-- 
Spare Space.


pgsql-general by date:

Previous
From: jimmy
Date:
Subject: how to know that one query use the data in the os cache
Next
From: Deepti Sharma S
Date:
Subject: RE: [GENERAL] Postgre compatible version with RHEL 7.5