Re: Getting out ahead of OOM - Mailing list pgsql-admin

From Tom Lane
Subject Re: Getting out ahead of OOM
Date
Msg-id 1117736.1741375563@sss.pgh.pa.us
Whole thread Raw
In response to Getting out ahead of OOM  (Joseph Hammerman <joe.hammerman@datadoghq.com>)
Responses Re: Getting out ahead of OOM
List pgsql-admin
Joseph Hammerman <joe.hammerman@datadoghq.com> writes:
> We run Postgres in a Kubernetes environment, and we have not to date been
> able to convince our Compute team to create a class of Kubernetes hosts
> that have memory overcommit disabled.

:-(

> Has anyone had success tracking all the Postgres memory allocation
> configurables and using that to administratively prevent OOMing?

I doubt anyone has tried that.  I would look into whether running
the postmaster under a suitable ulimit helps.  I seem to recall
discussions that in Linux, "ulimit -v" works better than the other
likely-looking options.  But that might be stale information.

> Alternatively, has anyone has success implementing an extension or periodic
> process to monitor the memory consumption of the Postgres children and
> killing them before the OOM event occurs?

That's not going to be noticeably nicer than the kernel-induced
OOM, I think.  The one thing it might do for you is ensure that
the kill happens to a child process and not the postmaster; but
you can already use PG_OOM_ADJUST_VALUE and PG_OOM_ADJUST_FILE
to manage that if it's a problem.  (Recent kernels are alleged
to usually do the right thing without that, though.)

            regards, tom lane



pgsql-admin by date:

Previous
From: Joseph Hammerman
Date:
Subject: Getting out ahead of OOM
Next
From: Rui DeSousa
Date:
Subject: Re: Getting out ahead of OOM