Balkrishna Sharma wrote:
1. Keeping the kernel parameter kernel.shmmax at 75% of RAM (i.e. at 3GB )kernel.shmmax = 3221225472 2. Keeping the kernel parameter shmall at the same value. Because shmall is measured in number of pages and each page on my linux is 4096 bytes, having kernel.shmall = 786432 (786432 * 4096 = 3221225472, same as shmmax)
There's little reason to put shmmax at over 50% of RAM, because shared_buffers is going to be significantly lower than that even. I use the attached script for this job now; I got sick of doing the math manually all the time. If you're on a system that supports returning memory info using getconf, it outputs the lines you need to put into the kernel configuration.
-- Greg Smith 2ndQuadrant US Baltimore, MD PostgreSQL Training, Services and Support greg@xxxxxxxxxxxxxxx www.2ndQuadrant.us
#!/bin/bash # Output lines suitable for sysctl configuration based # on total amount of RAM on the system. The output # will allow up to 50% of physical memory to be allocated # into shared memory. # On Linux, you can use it as follows (as root): # # ./shmsetup >> /etc/sysctl.conf # sysctl -p # Early FreeBSD versions do not support the sysconf interface # used here. The exact version where this works hasn't # been confirmed yet. page_size=`getconf PAGE_SIZE` phys_pages=`getconf _PHYS_PAGES` if [ -z "$page_size" ]; then echo Error: cannot determine page size exit 1 fi if [ -z "$phys_pages" ]; then echo Error: cannot determine number of memory pages exit 2 fi shmall=`expr $phys_pages / 2` shmmax=`expr $shmall \* $page_size` echo \# Maximum shared segment size in bytes echo kernel.shmmax = $shmmax echo \# Maximum number of shared memory segments in pages echo kernel.shmall = $shmall
-- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin