Обсуждение: shared memory settings

Поиск
Список
Период
Сортировка

shared memory settings

От
Alexander Shutyaev
Дата:
Hi all!

We have at present the following parameters related to shared memory:

postgres

shared_buffers = 7GB
max_connections = 1500
max_locks_per_transaction = 1024
max_prepared_transactions = 0 (not set)

system

SHMALL = 2097152
SHMMAX = 17 670 512 640
SHMMNI = 4096

The amount of RAM is 24 693 176k

We need to increase max_connections to 3000. When we tried to do this we got an error

[1-1] FATAL:  could not create shared memory segment: No space left on device
[2-1] DETAIL:  Failed system call was shmget(key=5432001, size=8964661248, 03600).
[3-1] HINT:  This error does *not* mean that you have run out of disk space.  It occurs either if all available shared memory IDs have been taken, in which case you need to raise the SHMMNI parameter in your kernel, or because the system's overall limit for shared memory has been reached.  If you cannot increase the shared memory limit, reduce PostgreSQL's shared memory request (currently 8964661248 bytes), perhaps by reducing shared_buffers or max_connections.
The PostgreSQL documentation contains more information about shared memory configuration.

The hint proposes to increase SHMMNI kernel parameter, but I'm not sure about how much to add :) Also, do we need to change any other parameters accordingly?

Thanks in advance,
Alexander

Re: shared memory settings

От
Devrim GÜNDÜZ
Дата:
Hi,

On Wed, 2012-09-26 at 13:39 +0400, Alexander Shutyaev wrote:

> We need to increase max_connections to 3000. When we tried to do this
> we got an error

<snip>

Not an answer to your question but: Are you talking about 3k
*concurrent* connections? What are the server specs? I am not sure you
can handle that many connections, unless you are using HP DL 980 or  HP
Superdome or so.

You also may want to consider using connection pooler, namely pgbouncer.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Вложения

Re: shared memory settings

От
Vick Khera
Дата:
On Wed, Sep 26, 2012 at 5:39 AM, Alexander Shutyaev <shutyaev@gmail.com> wrote:
SHMALL = 2097152

SHMALL * PAGE_SIZE = 2097152 * 4096 = 8589934592

which is smaller than your requested allocation.

SHMALL and SHMMAX need to be sized together.  You likely want 4314090 as your SHMALL.

Bug as Devrim says, are you sure you can handle that?  Perhaps you want a connection pooler instead.