postgres memory management issues?

From: Richard Yen <dba(at)richyen(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: postgres memory management issues?
Date: 2007-09-06 16:06:53
Message-ID: ADDEA1D0-FEEF-4FAD-950E-BC9E49439DF0@richyen.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi All,

I've recently run into problems with my kernel complaining that I ran
out of memory, thus killing off postgres and bringing my app to a
grinding halt.

I'm on a 32-bit architecture with 16GB of RAM, under Gentoo Linux.
Naturally, I have to set my shmmax to 2GB because the kernel can't
support more (well, I could set it to 3GB, but I use 2GB for safety).

Shared_buffers is 200000 and max_connections is 600.

Here is a snippet of my log output (I can give more if necessary):
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com Out of Memory: Kill
process 11696 (postgres) score 1181671 and children.
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com Out of Memory: Kill
process 11696 (postgres) score 1181671 and children.
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com Out of memory: Killed
process 11704 (postgres).
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com Out of memory: Killed
process 11704 (postgres).
[...]
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com postgres[11696]: [6-1]
2007-09-05 18:38:57.626 PDT [user=,db= PID:11696 XID:]LOG:
background writer process (PID 11704) was terminated by signal 9
Sep 5 18:38:57 tii-db2.oaktown.iparadigms.com postgres[11696]: [7-1]
2007-09-05 18:38:57.626 PDT [user=,db= PID:11696 XID:]LOG:
terminating any other active server processes

My understanding is that if any one postgres process's memory usage,
plus the shared memory, exceeds the kernel limit of 4GB, then the
kernel will kill the process off. Is this true? If so, would
postgres have some prevention mechanism that would keep a particular
process from getting too big? (Maybe I'm being too idealistic, or I
just simply don't understand how postgres works under the hood)

--Richard

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Broersma Jr 2007-09-06 16:08:29 Re: ADO -PostgreSQL OLE DB Provider
Previous Message Florian Weimer 2007-09-06 15:21:35 Re: Hardware spec