Search Postgresql Archives

Re: Preventing OOM kills

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-05-24 at 17:32 -0700, Yang Zhang wrote:
> PG tends to be picked on by the Linux OOM killer, so lately we've been
> forcing the OOM killer to kill other processes first with this script:
> 
> while true; do
>   for i in `pgrep postgres`; do
>     echo -17 > /proc/$i/oom_adj
>   done
>   sleep 60
> done
> 
> Is there a Better Way?  Thanks in advance.

Why don't you start postmaster with this value? Here is what we do in
RPM init scripts.

PG_OOM_ADJ=-17
	test x"$PG_OOM_ADJ" != x && echo "$PG_OOM_ADJ" > /proc/self/oom_adj
        $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null

Regards,
-- 
Devrim GÃNDÃZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL DanÄÅmanÄ/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Attachment: signature.asc
Description: This is a digitally signed message part


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux