2012-09-27 3 views
11

Ciao a tutti!postgresql impostazioni memoria condivisa

Abbiamo attualmente i seguenti parametri relativi alla memoria condivisa:

postgres

shared_buffers = 7GB 
max_connections = 1 500 
max_locks_per_transaction = 1 024 
max_prepared_transactions = 0 (not set) 

sistema

SHMALL = 2 097 152 
SHMMAX = 17 670 512 640 
SHMMNI = 4096 

La quantità di RAM è 24 693 176k

Dobbiamo aumentare max_connections-3 000. Quando abbiamo cercato di fare questo, abbiamo ottenuto un errore

[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. 

Il suggerimento propone di aumentare SHMMNI parametro del kernel, ma non sono sicuro di come molto da aggiungere :) Inoltre, credo che tutti questi parametri siano correlati in qualche modo, quindi dobbiamo modificare di conseguenza qualsiasi altro parametro?

Grazie in anticipo,

Alexander

risposta

17

Aumentare SHMMNI non aiuterà, è la seconda parte del suggerimento che conta qui.

Ottieni le dimensioni della pagina del tuo sistema con il comando shell getconf PAGE_SIZE.
Di solito è 4096. Moltiplicalo per SHMALL.

Nel tuo caso dovrebbe essere 2097152 * 4096 = 8589934592, che è esattamente 8 GB. Questa è la tua massima memoria condivisa corrente, indipendentemente da SHMMNI.

Il messaggio di errore PostgreSQL indica che è necessario un po 'di più.

Conclusione: aumento SHMALL.

+2

grazie mille per la risposta! – shutyaev

+1

Nota: Come per la sezione linux dei documenti (postgresql.org/docs/9.0/static/kernel-resources.html), il valore di SHMALL dovrebbe essere PAGE_SIZE diviso per SHMAX. –