pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas O'Connell <tfo@monsterlabs.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: performance tuning: shared_buffers, sort_mem; swap
Date: Tue, 13 Aug 2002 17:02:47 -0400
Message-ID: <1101.1029272567@sss.pgh.pa.us> (raw)
In-Reply-To: <tfo-549650.13201613082002@news.hub.org>
References: <27214.1029257785@sss.pgh.pa.us>
	<tfo-549650.13201613082002@news.hub.org>

"Thomas O'Connell" <tfo@monsterlabs.com> writes:
> In article <27214.1029257785@sss.pgh.pa.us>,
>  tgl@sss.pgh.pa.us (Tom Lane) wrote:
>> Uh, which error exactly?  AFAIK all the shared-memory-related messages
>> would only come out at postmaster startup, not during peak load.  The
>> system is designed to ensure that those resources are all reserved
>> during postmaster start.

> Sorry, I should've included the whole error in the first place:

> "IpcMemoryCreate: shmget(key=5432001, size=72368128, 03600) failed: 
> Invalid argument 

Hmm.  That's definitely a startup-time error.  The only way that code
could be executed later than postmaster startup is if you suffer a
database crash and the postmaster is trying to reinitialize the system
with a fresh shared-memory arena.  That would say that this isn't your
primary problem, but a consequence of a crash that'd already occurred.

I am curious why you'd get "Invalid argument" (EINVAL), as presumably
these are the same arguments that the kernel accepted on the previous
cycle of life.  But that's probably not the issue to focus on.

My bet for the cause of the database crash is the same as Bruce's:
the Linux kernel is known to "kill -9" processes at random when it
gets under sufficiently heavy memory pressure.  If it happens to select
a database backend to kill, the postmaster will interpret the backend's
unexpected exit as a crash, and will force a database restart.  Perhaps
when the postmaster tries to reallocate the shmem segment a few
milliseconds later, the kernel still thinks it's under load and rejects
a shmem request that it'd normally have accepted.  (That last bit is
just speculation though.)

Possible solutions: (a) buy more RAM and/or increase available swap
space (I'm not sure whether more swap, without more physical RAM,
actually helps; anyone know?); (b) reduce peak load by reducing
max_connections and/or scaling back your other servers; (c) switch to
another OS --- I don't think the *BSD kernels have this brain-damaged
idea about how to cope with low memory...

			regards, tom lane



view thread (23+ messages)  latest in thread

Message-ID: <1101.1029272567@sss.pgh.pa.us>
Permalink:  ../1101.1029272567@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1101.1029272567@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tfo@monsterlabs.com
  Subject: Re: performance tuning: shared_buffers, sort_mem; swap
  In-Reply-To: <1101.1029272567@sss.pgh.pa.us>
  References: <27214.1029257785@sss.pgh.pa.us> <tfo-549650.13201613082002@news.hub.org> <1101.1029272567@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox