Hello,
We are running PostgreSQL version 9.1.1 with 32GB of RAM, 32GB of SWAP and during high load we could reach (swap + RAM) memory limit. In this case OOM-killer kills postgresql process(es). (Out of Memory: Killed process 12345 (postgres)). As admin I would like to exclude postgresql system processes from being chosen by OOM-killer. Based on the PostgreSQL documentation it could be done by properly setting vm.overcommit_memory=2, vm.overcommit_ratio=(probably between 50 and 90) and set the process-specific oom_adj value for the postmaster process to -17, thereby guaranteeing it will not be targeted by the OOM killer. The PostgreSQL should build with -DLINUX_OOM_ADJ=0 added to CPPFLAGS to have child processes oom_adj equal to 0.
1) Will this setting means other system processes (logger process, writer process, stats collector process, wal receiver process, etc..), which are children of postmaster process, will be running with oom_adj set to 0 too?
2) Should the proper Postgresql compilation configuration be: ./configure ... CPPFLAGS="-DLINUX_OOM_ADJ=0" ...
3) Does somebody has experience with this solution for CentOS kernel 2.6.18-308.el5 x86_64?
Sincerely,
Radovan Jablonovsky