Configure a box for Kernel and Postgres configuration

shmall set to 90% of memory / 4Kb page size

shmax is set to max memory on the system

Shared Memory Section:

SHMALL is the maximum allocation of shared memory pages on a system.

SHMALL

7351426.8 divided by 4KB  = 1837856.7 (This is set in the sysctl conf file)

 

SHMMAX is the maximum size of a shared memory segment on a Linux system

SHMAX:

Minimum required on 64 bit systems is = 1073741824 (1 GB)

Minimum required on x86 systems is 268435456 (256 MB)

 

SHMMNI remains same as 4096

 

Semaphore section:

SEMMSL, SEMMNS, SEMOPM and SEMMNI.

SEMMNS = SEMMSL x SEMMNI

 

SEMMNI = Number of arrays = ( twice Maximum number of connections) * multiplied by the number of logical partitions on the database server + number of local application connections on the database server

 

SEMOPM = 32

SEMMSL = 250

SEMMNI = ((2 * max connections) * logical partitions on the server + number of local applications (max app server connections) )

SEMMNS = 250 * SEMMNI

 

Message Section:

No changes with the message section

 

To set the values in sysctl.conf file

 

edit /etc/sysctl.conf

 

kernel.sem=SEMMSL SEMMNS SEMOPM SEMMNI

kernel.shmmax=1073741824

kernel.shmall= 1837856

kernel.msgmax=65535

kernel.msgmnb=65535

 

Run sysctl with -p parameter to load in sysctl settings from the default file /etc/sysctl.conf

sysctl -p

Postgresql configuration:

shared_buffers = 2.5GB

work_mem = 32MB

maintenance_work_mem = 256MB

 

# – Checkpoints – Let the checkpoint be default

 

#checkpoint_segments = 3                # in logfile segments, min 1, 16MB each

#checkpoint_timeout = 5min              # range 30s-1h

#checkpoint_completion_target = 0.5     # checkpoint target duration, 0.0 – 1.0

#checkpoint_warning = 30s               # 0 disables

example:

RAM = 8GB (1048576 * 8 )
shmax = 8GB
shmall = (90% of 8 *1024*1024) / 4 = (90% of 8388608) / 4 = 7549747.2 / 4 = 1887436.8

SHMMNI = 4096
SEMOPM = 32
SEMMSL = 250
SEMMNI = 6000

SEMMSL SEMMNS SEMOPM SEMMNI
250 1500000 32 6000

SHMAX = 8589934592 (in bytes)
SHMALL = 1887436 (in kilo bytes)

kernel.msgmax=65535
kernel.msgmnb=65535

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s