Postgres与OS内核相关的几个参数设置(二)
localhost ~]# sysctl -w kernel.sem="500 64000 50 150"
kernel.sem = 500 64000 50 150
[root@localhost ~]# cat /proc/sys/kernel/sem
500 64000 50 150
附参数说明
Name
Desc
Reasonable Value
shmmax
Maximum size of shared memory segment (bytes)
at least several megabytes (see text)
shmmin
Minimum size of shared memory segment (bytes)
1
shmall
Total amount of shared memory available (bytes or pages)
if bytes, same as SHMMAX; if pages, ceil(SHMMAX/PAGE_SIZE)
shmseg
Maximum number of shared memory segments per process
only 1 segment is needed, but the default is much higher
shmmni
Maximum number of shared memory segments system-wide
like SHMSEG plus room for other applications
semmni
Maximum number of semaphore identifiers (i.e., sets)
at least ceil((max_connections + autovacuum_max_workers + 4) / 16)
semmns
Maximum number of semaphores system-wide
ceil((max_connections + autovacuum_max_workers
+ 4) / 16) * 17 plus room for other applications
semmsl
Maximum number of semaphores per set
at least 17
semmap
Number of entries in semaphore map
see text
semvmx
Maximum value of semaphore
at least 1000 (The default is often 32767; do not change unless necessary)
共享内存的使用:
usage
Approximate shared memory bytes
Connections
(1800 + 270 * max_locks_per_transaction) * max_connections
Autovacuum workers
(1800 + 270 * max_locks_per_transaction) * autovacuum_max_workers
Prepared transactions
(770 + 270 * max_locks_per_transaction) * max_prepared_transactions
Shared disk buffers
(block_size + 208) * shared_buffers
Wal buffers
(wal_block_size + 8) * wal_buffers
Fixed space requirements
770KB