Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

shmmax

Old News System V IPC Recommended Links Reference History Humor Etc.

Before installing database system, you should tune Linux kernel parameters. The default values for particular kernel parameters on Linux are not sufficient when running a database system. Most databases need higher IPC limits. They can increase them dynamically. However, it may be more practical to set the limits permanently

You must have root authority to modify kernel parameters.

To update kernel parameters:

Red Hat and SUSE Linux
The following information can be used to determine if there are any necessary changes required for your system.

The following is the output from the ipcs -l command. Comments have been added following the // to show what the parameter names are.

   # ipcs -l

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

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

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

Beginning with the first section on Shared Memory Limits, SHMMAX and SHMALL are the parameters that need to be looked at. 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.

For SHMMAX, the minimum required on x86 systems would be 268435456 (256 MB) and for 64-bit systems, it would be 1073741824 (1 GB).

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 DB2, then this parameter should be increased to approximately 90% of the physical memory as specified for your computer. For instance, if you have a computer system with 16 GB of memory to be used primarily for DB2, then 90% of 16 GB is 14.4 GB divided by 4 KB (the base page size) is 3774873. The ipcs output has converted SHMALL into kilobytes. The kernel requires this value as a number of pages.

The next section covers the amount of semaphores available to the operating system. The kernel parameter sem 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 computer plus the number of local application connections on the database server computer.

The third section 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.

MSGMAX should be change to 64 KB (that is, 65535 bytes), and MSGMNB should be increased to 65535 on Server systems.

To modify these kernel parameters, we need to edit the /etc/sysctl.conf file. If this file does not exist, it should be created. The following lines are examples of what should be placed into the file:

kernel.sem=250 256000 32 1024
#Example shmmax for a 64-bit system
kernel.shmmax=1073741824	
#Example shmall for 90 percent of 16 GB memory
kernel.shmall=3774873		
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

To make the changes effective after every reboot, boot.sysctl needs to be active on SUSE Linux. On Red Hat, the rc.sysinit initialization script will read the /etc/sysctl.conf file automatically.

Reference

shmmax specifies system-wide maximum allowable shared memory segment size.

Acceptable Values:

Minimum
2048 (2 Kbytes)
Maximum
0x40000000 (1024 Mbytes) on 32-bit systems
Maximum 1 Tbyte on 64-bit systems
Default
0x04000000 (64 Mbytes)

Specify integer value. For more information, see Specifying Parameter Values.

The value used cannot exceed maximum available swap space. For minimum and maximum allowable values, as well as default value for any given system, refer to values in /etc/conf/master.d/* files.

Description

shmmax defines the system-wide maximum allowable shared memory segment size in bytes. Any shmget() system call that requests a segment larger than this limit returns an error (see HP-UX Reference entry shmget(2)).

Related Parameters

None.

Recommended Links



Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 13, 2009