Re: Out of Memory

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Out of Memory
Date: 2018-09-27 06:30:39
Message-ID: 20180927063039.n5ea4xuefxtrbusa@squirrel.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

## Laurenz Albe (laurenz(dot)albe(at)cybertec(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Deepti Sharma S 2018-09-27 09:05:16 RE: [GENERAL] Postgre compatible version with RHEL 7.5
Previous Message jimmy 2018-09-27 05:39:14 how to know that one query use the data in the os cache