pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Relation between RAM / shmmax / shmall / shared_buffers
3+ messages / 3 participants
[nested] [flat]

* Relation between RAM / shmmax / shmall / shared_buffers
@ 2010-05-25 18:05 Balkrishna Sharma <b_ki@hotmail.com>
  2010-05-25 18:10 ` Re: Relation between RAM / shmmax / shmall / shared_buffers Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-05-28 19:08 ` Re: Relation between RAM / shmmax / shmall / shared_buffers Greg Smith <greg@2ndquadrant.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Balkrishna Sharma @ 2010-05-25 18:05 UTC (permalink / raw)
  To: pgsql-admin


Hi,
I am having a transactional database heavy on parallel reads and updates. Apart from hardware optimization, I want to ensure that my system parameters are optimized as well. Following is what I am doing on my test system having 4GB RAM. Please let me know if the logic sounds ok (at least at high-level) and if there are other related parameters I should tweak as well:
RAM = 4GB1. Keeping the kernel parameter kernel.shmmax at 75% of RAM (i.e. at 3GB )kernel.shmmax = 32212254722. 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)3. Keeping the shared_buffer parameter in the postgresql.conf file to be 25% of the kernel.shmmax. i.e. shared_buffers = 768MB (25% of 3072 MB)

Thanks,-Bala
 		 	   		  
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3=

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Relation between RAM / shmmax / shmall / shared_buffers
  2010-05-25 18:05 Relation between RAM / shmmax / shmall / shared_buffers Balkrishna Sharma <b_ki@hotmail.com>
@ 2010-05-25 18:10 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  1 sibling, 0 replies; 3+ messages in thread

From: Kevin Grittner @ 2010-05-25 18:10 UTC (permalink / raw)
  To: Balkrishna Sharma <b_ki@hotmail.com>; pgsql-admin

Balkrishna Sharma <b_ki@hotmail.com> wrote:
 
> [Are there] other related parameters I should tweak as well[?]
 
There are several which should probably be adjusted.  See:
 
http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
 
-Kevin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Relation between RAM / shmmax / shmall / shared_buffers
  2010-05-25 18:05 Relation between RAM / shmmax / shmall / shared_buffers Balkrishna Sharma <b_ki@hotmail.com>
@ 2010-05-28 19:08 ` Greg Smith <greg@2ndquadrant.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Greg Smith @ 2010-05-28 19:08 UTC (permalink / raw)
  To: Balkrishna Sharma <b_ki@hotmail.com>; +Cc: pgsql-admin

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@2ndQuadrant.com   www.2ndQuadrant.us

Attachments:

shmsetup (text/plain, 914B) download #!/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
^ permalink raw reply [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-05-28 19:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-25 18:05 Relation between RAM / shmmax / shmall / shared_buffers Balkrishna Sharma <b_ki@hotmail.com>
2010-05-25 18:10 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-05-28 19:08 ` Greg Smith <greg@2ndquadrant.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox