Kernel parameter requirements (Linux)

The database manager uses a formula to automatically adjust kernel parameter settings and eliminate the need for manual updates to these settings.

Interprocess communication kernel parameters

When instances are started, if an interprocess communication (IPC) kernel parameter is below the enforced minimum value, the database manager updates it to the enforced minimum value. The IPC kernel parameter values change when a Db2® instance is started.
Attention: The IPC kernel parameter values changed when a Db2 instance is started do not persist when the system is rebooted. After a reboot, kernel settings might be lower than the enforced values until a Db2 instance is started. By adjusting the kernel parameter settings, the database manger prevents unnecessary resource errors.
Table 1. Enforced minimum settings for Linux interprocess communication kernel parameters
IPC kernel parameter Enforced minimum setting
kernel.shmmni (SHMMNI) 256 * <size of RAM in GB>
kernel.shmmax (SHMMAX) <size of RAM in bytes>1
kernel.shmall (SHMALL) 2 * <size of RAM in the default system page size>2
kernel.sem (SEMMNI) 256 * <size of RAM in GB>3
kernel.sem (SEMMSL) 250
kernel.sem (SEMMNS) kernel.sem (SEMMNI) or 256 000 whichever value is greater
kernel.sem (SEMOPM) 32
kernel.msgmni (MSGMNI) 1 024 * <size of RAM in GB>
kernel.msgmax (MSGMAX) 65 536
kernel.msgmnb (MSGMNB) 65 536 4
  1. On 32-bit Linux® operating systems, the enforced minimum setting for SHMMAX is limited to 4 294 967 295 bytes.
  2. SHMALL limits the total amount of virtual shared memory that can be allocated on a system. Each Db2 data server efficiently manages the amount of system memory that it uses, is , known as committed memory. The Db2 data server allocates more virtual memory than it commits to support memory preallocation and dynamic memory management. Memory preallocation benefits performance. Dynamic memory management is the process of growing and shrinking real memory usage within separate virtual shared memory areas. To support memory preallocation and dynamic memory management effectively, data servers frequently must allocate more virtual shared memory on a system than the amount of physical RAM. The kernel requires this value as a number of pages.
  3. If the kernel command-line parameter ipcmni_extend is not enabled or the system has less than 128 GB of RAM, this value is set to 32768.
  4. Load performance might benefit from a larger message queue size limit, which is specified in bytes by MSGMNB. You can view message queue usage by running the ipcs -q command. If the message queues are at capacity, or reaching capacity, during load operations, consider increasing the number of bytes the message queue size limit.

Enforced minimum kernel parameter settings

When instances are started, if a kernel parameter is below the enforced minimum value, the database manager updates it to the enforced minimum value. The kernel parameter values change when a Db2 instance is started.
Attention: The kernel parameter values changed when a Db2 instance is started do not persist when the system is rebooted. After a reboot, kernel settings might be lower than the enforced values until a Db2 instance is started. By adjusting the kernel parameter settings, the database manger prevents unnecessary resource errors.
Table 2. Enforced minimum values for kernel parameters
Kernel parameter Enforced minimum value
fs.file-max 16384
fs.aio-max-nr 1048576
Note: This parameter is enforced starting in Db2 version 11.5.4 and later.
vm.max_map_count <size of RAM in bytes> / 4096
kernel.panic_on_oops 51
  1. This parameter is only changed in pureScale configurations

Other recommended kernel parameter settings

Other recommended kernel parameter settings are listed in the following table.
Table 3. Configuring other Linux kernel parameters
Recommended kernel parameter setting Configuring the kernel parameters for Db2 data server
vm.swappiness=5

This parameter defines how prone the kernel is to swapping application memory out of physical random access memory (RAM). The default setting is vm.swappiness=60. The recommended kernel parameter setting, vm.swappiness=5, gives preference to the application memory in RAM instead of assigning more memory for file caching.

vm.swappiness parameter has a little effect on swap behaviour on a system with cgroups v1. This may lead to unexpected swapping while there are plenty of reclaimable page cache available. To address the issue new vm.force_cgroup_v2_swappiness was added to RHEL 8.7 It is recommended to set it to 1 while using cgroups v1.

For more information please refer to Premature swapping while there is still plenty of page cache to be reclaimed.

vm.overcommit_memory=0 This parameter influences how much virtual memory the kernel permits allocating. The default setting is vm.overcommit_memory=0. This setting means that the allocated virtual memory is unlimited. Having unlimited virtual memory is important for Db2 data servers, which retain extra unused virtual memory allocations for dynamic memory management. Unreferenced allocated memory is not backed by RAM or paging space on Linux systems. Avoid setting vm.overcommit_memory=2, as this setting limits the total amount of virtual memory that can be allocated, which can result in unexpected errors.
TasksMax For more information on this kernel parameter, refer to Troubleshooting - TasksMax set too low.
ipcmni_extend

This parameter is recommended on newer Linux Red Hat kernels as these kernels can limit some parameters such as SHMMNI, SEMMNI and MSGMNI to 32768. If users have over 128GB of RAM, then the recommendations will not work unless the ipcmni_extend parameter is set.

For more information, see db2start fails due to enforcement of maximum semaphore arrays on newer Linux Kernels.