pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Size estimation of postgres core files
Date: Sun, 24 Feb 2019 13:08:04 +0100
Message-ID: <20190224120804.mfqk2scjzbitbbv7@hjp.at> (raw)
In-Reply-To: <CAMa1XUgd79VBYFHs=uTQB+YkXQjw-YxEQtB=USwL4BDPAVJD4g@mail.gmail.com>
References: <CAMa1XUgzVPRs9TiEm_sotK3ZNR_oUZWO183NP1RMKOkt6T2-zA@mail.gmail.com>
	<20190215163655.GA16325@alvherre.pgsql>
	<CAMa1XUh8PF+20H-sU9M2S0MznbV1tNuA07whGN9A+jq=gM+zvA@mail.gmail.com>
	<87d0nslxju.fsf@news-spur.riddles.org.uk>
	<CAMa1XUgd79VBYFHs=uTQB+YkXQjw-YxEQtB=USwL4BDPAVJD4g@mail.gmail.com>

On 2019-02-15 13:01:50 -0600, Jeremy Finzel wrote:
>     It doesn't write out all of RAM, only the amount in use by the
>     particular backend that crashed (plus all the shared segments attached
>     by that backend, including the main shared_buffers, unless you disable
>     that as previously mentioned).

> Based on the Alvaro's response, I thought it is reasonably possible that that
> *could* include nearly all of RAM, because that was my original question.  If
> shared buffers is say 50G and my OS has 1T, shared buffers is a small portion
> of that.  But really my question is what should we reasonably assume is
> possible

The size of the core dump will be roughly the same as the VM used by the
process - so that will be the initial size of the process plus shared
buffers plus a (usually small) multiple of work_mem or
maintenance_work_mem plus whatever memory the process allocates.

The big unknown is that "(usually small) multiple of work_mem". I've
seen a process use 8 times work_mem for a moderately complex query, so
depending on what you do it might be worse.

The extra memory allocated by processes is usually small (after all, if
some datastructure were expected to be potentially large it would
probably be limited by work_mem), but if there is a bug (and that's what
you are looking for) it might really grow without bounds.

If you know some upper bound for a reasonable size of your processes you
could set the address space limit - not only will this limit the core
dump size, but it will also prevent a single process from consuming all
RAM and triggering the OOM killer.

You probably don't want to limit the core dump size directly (another
process limit you can set) as that will result in a truncated (and
possibly useless) core dump. For similar reasons I'm not convinced that
omitting the shared memory is a good idea.

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp@hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/;

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (6+ messages)

Message-ID: <20190224120804.mfqk2scjzbitbbv7@hjp.at>
Permalink:  ../20190224120804.mfqk2scjzbitbbv7@hjp.at/
Also on:    postgresql.org/message-id/20190224120804.mfqk2scjzbitbbv7@hjp.at

 · 

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-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Size estimation of postgres core files
  In-Reply-To: <20190224120804.mfqk2scjzbitbbv7@hjp.at>
  References: <CAMa1XUgzVPRs9TiEm_sotK3ZNR_oUZWO183NP1RMKOkt6T2-zA@mail.gmail.com> <20190215163655.GA16325@alvherre.pgsql> <CAMa1XUh8PF+20H-sU9M2S0MznbV1tNuA07whGN9A+jq=gM+zvA@mail.gmail.com> <87d0nslxju.fsf@news-spur.riddles.org.uk> <CAMa1XUgd79VBYFHs=uTQB+YkXQjw-YxEQtB=USwL4BDPAVJD4g@mail.gmail.com> <20190224120804.mfqk2scjzbitbbv7@hjp.at>

* 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