From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Setting oom_adj on linux? |
Date: | 2010-01-04 16:41:42 |
Message-ID: | 9837222c1001040841t5c80b616tc56114e7f98a0970@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jan 4, 2010 at 17:40, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>
> Magnus Hagander wrote:
>>
>> On Mon, Jan 4, 2010 at 17:07, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>>>
>>> Magnus Hagander wrote:
>>>
>>>>
>>>> On Mon, Jan 4, 2010 at 16:45, Alvaro Herrera
>>>> <alvherre(at)commandprompt(dot)com>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> Magnus Hagander wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> I realize this is a very platform-specific thing, but should we
>>>>>> consider setting the value of /proc/<pid>/oom_adj when running on
>>>>>> linux? See:
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> http://archives.postgresql.org/message-id/20080201223336.GC24780%40alvh.no-ip.org
>>>>>
>>>>>
>>>>
>>>> Grr. I had zero recollectoin of that :S
>>>>
>>>> Can't find a useful consensus though?
>>>>
>>>>
>>>>
>>>
>>> It is probably worth trying to protect the postmaster in the init script.
>>> Beyond that things probably start to get fairly difficult.
>>>
>>
>> Right. But AFAICS (though I haven't tested with -17), it will become
>> inherited to children, which is something we'd want to *undo*, no?
>>
>
>
> [experiments]
>
> Yes, darnit, you're right. But it looks like the oom_adj file can be set to
> the default by the process owner:
>
> [andrew(at)sophia ~]$ ls -l /proc/6520/oom_adj
> -rw-r--r-- 1 andrew andrew 0 2010-01-04 12:37 /proc/6520/oom_adj
> [andrew(at)sophia ~]$ cat /proc/6520/oom_adj
> 0
> [andrew(at)sophia ~]$ id
> uid=500(andrew) gid=500(andrew) groups=10(wheel),500(andrew)
> [andrew(at)sophia ~]$ echo -17 > /proc/6520/oom_adj
> -bash: echo: write error: Permission denied
> [andrew(at)sophia ~]$ echo 0 > /proc/6520/oom_adj
> [andrew(at)sophia ~]$ echo -17 > /proc/6520/oom_adj
> -bash: echo: write error: Permission denied
> [andrew(at)sophia ~]$
>
> But that would be a pain to have to do.
>
> OTOH, disabling the OOM killer is not always an option. I recently tried it
> on one system and had to revert it rapidly because the system stopped
> working in minutes. Some software just doesn't live well in such
> environments, sadly.
Right. Which is why I like the idea of disabling the OOM killer for
the *postmaster*, but not the regular backends. Gives it a chance to
recover. It's not nice, but it's better than nothing.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-01-04 16:49:26 | Re: Setting oom_adj on linux? |
Previous Message | Andrew Dunstan | 2010-01-04 16:40:02 | Re: Setting oom_adj on linux? |