How to calculate shared memory size

From: Rébeli-Szabó Tamás <t(at)rblst(dot)info>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: How to calculate shared memory size
Date: 2020-09-15 14:12:39
Message-ID: cdaa511e1909ef15b2d8f86aa4330a9b@rblst.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

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

For that I need to know how much shared memory will be allocated at
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

However, if I only use 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 terms (in the order of 10 megabytes or more)
that I need to take into account to get a better result?

Regards,

tamas

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rébeli-Szabó Tamás 2020-09-15 14:15:14 How to calculate shared memory size
Previous Message Vasu Madhineni 2020-09-15 10:46:34 Re: multiple tables got corrupted