pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rébeli-Szabó Tamás <pub@rblst.info>
To: pgsql-general@lists.postgresql.org
Subject: How to calculate shared memory size
Date: Tue, 15 Sep 2020 16:15:14 +0200
Message-ID: <12b98406e50a52930bb96c8f76b73e1d@rblst.info> (raw)

Hello all,

I want to do a proper calculation of the number of huge pages needed for 
PostgreSQL to start.

To do that, I need a good approximation of how much shared memory will 
be requested at server startup.

Looking at the shared memory calculation in the source (ipci.c), I can 
see that two terms stand out:

   size = add_size(size, BufferShmemSize()); ---> shared_buffers
   size = add_size(size, XLOGShmemSize()); --> 1/32 * shared_buffers, but 
max WAL segment size

If I use only those two terms ( shared buffers + WAL segment size) for 
my calculation, the result will be off by a lot, especially with bigger 
shared buffers (e.g. 32 GB).

What are any other major addends (in the order of 10 megabytes or more) 
that I need to take into account to get a better result?

Regards,

tamas






view thread (3+ messages)  latest in thread

Message-ID: <12b98406e50a52930bb96c8f76b73e1d@rblst.info>
Permalink:  ../12b98406e50a52930bb96c8f76b73e1d@rblst.info/
Also on:    postgresql.org/message-id/12b98406e50a52930bb96c8f76b73e1d@rblst.info

 · 

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: pub@rblst.info
  Subject: Re: How to calculate shared memory size
  In-Reply-To: <12b98406e50a52930bb96c8f76b73e1d@rblst.info>
  References: <12b98406e50a52930bb96c8f76b73e1d@rblst.info>

* 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