postgresqllinux-kerneldatabase-administrationpostgres-10

SHMMAX / SHMALL Kernel parameters for postgres database with huge_pages on


I've upgraded RAM on postgres server from 8 to 16 GB and set shared_buffer to 4GB. I'm also set

vm.nr_hugepages = 2300 

calculated by postgres doc

kernel.shmmax = 8589934592 (8GB) 

Postgres is configured to use huge_page (huge_page = 'on') with:

  grep -i hugepages /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:    2300
HugePages_Free:      167
HugePages_Rsvd:        4
HugePages_Surp:        0
Hugepagesize:       2048 kB

What's the correct configuration of kernel.shmall ?

According to doc kernel.shmall is espressed in number of PAGE memory (getconf PAGE_SIZE--> 4096) but Hugepagesize:2048 kb. Current configuration is kernel.shmall=4096 considering PAGE size 2048 kb but I'm not sure that is correct. Can you help me to understand this configuration please and if something is wrong. To setting kernel.shmall I must consider PAGE size = 2048 kb or PAGE size = 4096 byte? And what's the best configuration of these parameters?

Thanks


Solution

  • PostgreSQL v10 uses POSIX shared memory unless you set shared_memory_type = sysv, so the System V shared memory kernel parameters are irrelevant, and you don't have to tune them.