Modifying kernel parameters (Linux)
The database manager uses a formula to automatically adjust kernel parameter settings and eliminate the need for manual updates to these settings.
Before you begin
root
authority to modify kernel
parameters.Procedure
To update kernel parameters on Red Hat and SUSE Linux, follow these steps:
- Run the ipcs -l command to list the current kernel parameter settings.
-
Analyze the command output to determine whether you have to change kernel settings or not by
comparing the current values with the enforced minimum settings at http://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.qb.server.doc/doc/c0057140.html. The following text is an example of the ipcs
command output with comments added after
//
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, the SHMMAX limit is the maximum size
of a shared memory segment on a Linux system. The SHMALL limit is the maximum allocation of shared
memory pages on a system.
- It is recommended to set the SHMMAX value to be equal to the amount of physical memory on your system. However, the minimum required on x86 systems is 268435456 (256 MB) and for 64-bit systems, it is 1073741824 (1 GB).
- The SHMALL parameter is set to 8 GB by default (8388608 KB = 8 GB). If you have more physical memory than 8 GB, and it is to be used for DB2, then this parameter increases to approximately 90% of your computer's physical memory. For instance, if you have a computer system with 16 GB of memory to be used primarily for DB2, then SHMALL should be set to 3774873 (90% of 16 GB is 14.4 GB; 14.4 GB is then divided by 4 KB, which is the base page size). The ipcs output converted SHMALL into kilobytes. The kernel requires this value as a number of pages. If you are upgrading to DB2 Version 10.1 and you are not using the default SHMALL setting, you must increase the SHMALL setting by an additional 4 GB. This increase in memory is required by the fast communication manager (FCM) for additional buffers or channels.
- The next section covers the amount of semaphores available to the operating system. The kernel parameter sem consists of four 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 agents expected on the system 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.
- The MSGMNI parameter affects the number of agents that can be started; the MSGMAX parameter affects the size of the message that can be sent in a queue, and the MSGMNB parameter affects the size of the queue.
- The MSGMAX parameter should be changed to 64 KB (that is, 65536 bytes), and the MSGMNB parameter should be increased to 65536.
- Beginning with the first section on Shared Memory Limits, the SHMMAX limit is the maximum size
of a shared memory segment on a Linux system. The SHMALL limit is the maximum allocation of shared
memory pages on a system.
- Modify the kernel parameters that you have to adjust by
editing the /etc/sysctl.conf file. If this file does not exist, create
it. The following lines are examples of what should be placed into
the file:
#Example for a computer with 16GB of RAM: kernel.shmmni=4096 kernel.shmmax=17179869184 kernel.shmall=8388608 #kernel.sem=<SEMMSL> <SEMMNS> <SEMOPM> <SEMMNI> kernel.sem=250 1024000 32 4096 kernel.msgmni=16384 kernel.msgmax=65536 kernel.msgmnb=65536
- Run
sysctl
with-p
parameter to load in sysctl settings from the default file /etc/sysctl.conf:sysctl -p
- Optional: Have the changes persist after every
reboot:
- (SUSE Linux) Make
boot.sysctl
active. - (Red Hat) The
rc.sysinit
initialization script reads the /etc/sysctl.conf file automatically.
- (SUSE Linux) Make