Re: Shared memory usage in PostgreSQL 9.1 - Mailing list pgsql-general

From Christoph Zwerschke
Subject Re: Shared memory usage in PostgreSQL 9.1
Date
Msg-id 4EDA5632.8090801@online.de
Whole thread Raw
In response to Re: Shared memory usage in PostgreSQL 9.1  (Tomas Vondra <tv@fuzzy.cz>)
Responses Re: Shared memory usage in PostgreSQL 9.1
Re: Shared memory usage in PostgreSQL 9.1
Re: Shared memory usage in PostgreSQL 9.1
Re: Shared memory usage in PostgreSQL 9.1
List pgsql-general
Am 03.12.2011 15:34, schrieb Tomas Vondra:
 > Do you need to know an exact value or are you just interested why the
 > values in docs are not exact?

Both. I'm writing an installation script that calculates the necessary
IPC memory and increases the limit on the OS level (kernel.shmmax) if
needed. I want to increase the limit only as much as really necessary,
so I need to calculate the IPC usage as exactly as possible.

(Btw, what negative consequences - if any - does it have if I set
kernel.shmmax higher as necessary, like all available memory? Does this
limit serve only as a protection against greedy applications?)

 > If you want to see what exactly needs how much memory, check the
 > src/backend/storage/ipc/ipci.c file in sources. I've added some log
 > messages, and this is the result on my 64bit machine (using the values
 > you've posted):

Thanks a lot, that was helpful. So it seems the values in the docs are
only correct for a 32 bit server.

But I still don't understand this:

In our example, we have set shared_buffers to:

400 MB = 419430400 Bytes

but according to your log the used memory is:

buffers = 424669472 Bytes

This is a discrepancy of 1.25%.

The difference could be explained by taking credit for the descriptors
which may not be comprised in the shared_buffers setting, even if the
shared_buffers value is set in memory units. But according to the docs,
the descriptors should use 208/8192 = 2.5%. And on a 64bit machine, the
descriptors should use even more memory, i.e. up to 5%.

So I'm still a bit confused.

-- Christoph

pgsql-general by date:

Previous
From: Oleg Serov
Date:
Subject: Re: Postgresql + corrupted disk = data loss. (Need help for database recover)
Next
From: Tom Lane
Date:
Subject: Re: Shared memory usage in PostgreSQL 9.1