Wednesday, January 6, 2010

Kernel Parameters for RedHat Linux


$ ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096 // SHMMNI
max seg size (kbytes) = 66046570 // SHMMAX
max total shared memory (kbytes) = 66046568 // SHMALL
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128 // SEMMNI
max semaphores per array = 250 // SEMMSL
max semaphores system wide = 32000 // SEMMNS
max ops per semop call = 100 // SEMOPM
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 16 // MSGMNI
max size of message (bytes) = 65536 // MSGMAX
default max size of queue (bytes) = 65536 // MSGMNB

>> Set shmmax to 0.5 * Total Memory (free -b)

>> SHMMAX is the maximum size of a shared memory segment on a Linux system
whereas SHMALL is the maximum allocation of shared memory pages on a system.

>> SHMALL is set to 8 GB by default (8388608 KB = 8 GB). If you have more physical memory than this,
and it is to be used for oracle database, then this parameter should be increased to approximately
80% of the physical memory. For instance, if you have a server with 16 GB of memory to be used primarily
for oracle, then 80% of 16 GB is 12.8 GB divided by 4 KB (the base page size). The ipcs output has converted
SHMALL into kilobytes. The kernel requires this value as a number of pages.

>> The next section "Semaphore Limits" covers the amount of semaphores available to the operating system.
The kernel parameter semaphore consists of 4 tokens, SEMMSL, SEMMNS, SEMOPM and SEMMNI.
SEMMNS is the result of SEMMSL multiplied by SEMMNI.
The database manager requires that the number of arrays (SEMMNI) be increased as necessary.
Typically, SEMMNI should be twice the maximum number of connections allowed (MAXAGENTS) multiplied by the
number of logical partitions on the database server plus the number of local application connections
on the database server.

>> Section "Messages: Limits" covers messages on the system.

MSGMNI affects the number of agents that can be started, MSGMAX affects the size of the message that can be
sent in a queue, and MSGMNB affects the size of the queue.

To modify these kernel parameters, we need to edit the /etc/sysctl.conf file.
for example:
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 67631687680
kernel.sem=250 32000 100 128
kernel.shmmni=4096
kernel.shmall=16511642

Name Description
------ --------------------------------------------------------
SHMMAX Maximum size of shared memory segment (bytes)
SHMMIN Minimum size of shared memory segment (bytes)
SHMALL Total amount of shared memory available (bytes or pages)
SHMSEG Maximum number of shared memory segments per process
SHMMNI Maximum number of shared memory segments system-wide
SEMMNI Maximum number of semaphore identifiers (that is, sets)
SEMMNS Maximum number of semaphores system-wide
SEMMSL Maximum number of semaphores per set
SEMMAP Number of entries in semaphore map
SEMVMX Maximum value of semaphore