Tuning Red Hat Enterprise Linux for IBM DB2

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL) 5
  • Red Hat Enterprise Linux (RHEL) 6
  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux (RHEL) 8
  • Red Hat Enterprise Linux (RHEL) 9
  • IBM DB2 version 10.5+

Issue

  • How can I tune my Red Hat Enterprise Linux system for IBM DB2?
  • What are the recommended system tuneables for IBM DB2 running on Red Hat Enterprise Linux?

Resolution

  • The kernel tuning suggestions below were taken from the Content from www.ibm.com is not included.IBM Knowledge Center for version 10.5. Please work with IBM Support for any further questions you may have on these parameters and always double check with your Database Team.

  • IBM DB2 version 10.5 is supported on RHEL releases 5, 6 and 7.

  • Different versions of IBM DB2 may have slightly different parameters. For the most up-to-date requirements for IBM DB2 database products, see <Content from www.ibm.com is not included.http://www.ibm.com/support/docview.wss?uid=swg27038033>.

  • These are the enforced minimum settings for Linux per IBM for IBM DB2 version 10.5.

    IPC kernel parameter | Enforced minimum setting
    -|-
    kernel.shmmni (SHMMNI) | 256 * (size of RAM in GB)
    kernel.shmmax (SHMMAX) | (size of RAM in GB) 1
    kernel.shmall (SHMALL) | 2 * (size of RAM in the default system page size) 2
    kernel.sem (SEMMNI) | 256 * (size of RAM in GB)
    kernel.sem (SEMMSL) | 250
    kernel.sem (SEMMNS) | 256000
    kernel.sem (SEMOPM) | 32
    kernel.msgmni (MSGMNI) | 1024 * (size of RAM in GB)
    kernel.msgmax (MSGMAX) | 65536
    kernel.msgmnb (MSGMNB) | 65536

vm.swappiness

This parameter defines how prone the kernel is to swapping application memory out of physical random access memory (RAM). The default value is 60. The recommended kernel parameter below configures the kernel to give preference to keeping application memory in RAM instead of assigning more memory for file caching. This setting avoids unnecessary paging and excessive use of swap space for application pages.


vm.swappiness=1

Note: As of RHEL 6.4 and later, do not set vm.swappiness=0. In environments where an application server like SAP shares the host with DB2, the lowest setting you should use is vm.swappiness=1 and is perfectly acceptable. However in such cases, a value of 10 is often a reasonable compromise. See the Content from www.ibm.com is not included.IBM Tuning and Monitoring Database System Performance paper.

vm.swappiness=5 is recommended in Content from www.ibm.com is not included.IBM DB2 11.5 documentation

vm.overcommit_memory

This parameter influences how much virtual memory the kernel permits allocating. The default value of 0 sets the kernel to disallow individual processes from making excessively large allocations, however the total allocated virtual memory is unlimited. Avoid setting the value to 2, as this setting limits the total amount of virtual memory that can be allocated, which can result in unexpected errors.


vm.overcommit_memory=0

vm.dirty_ratio or vm.dirty_bytes, vm.dirty_background_ratio or vm.dirty_background_bytes

To influence the flushing/synchronizing modified Pagecache'd pages back out to the disk media on the Linux server, tuning the parameters vm.dirty parameters is important. However, due to the now growing memory sizes of servers where they are now in the Terabytes of memory, using the ratios vm.dirty_ratio and vm.dirty_background_ratio may be impractical due to their coarseness. For example, on a 2TB server a 1% ratio equates to a potential 20GB of modified Pagecache pages. Instead, consider using the vm.dirty_bytes and vm.dirty_background_bytes parameters as they offer more granularity.

For small sized servers (128GB or less) a good starting point is usually to set the following:


vm.dirty_ratio=10
vm.dirty_background_ratio=5

For servers of 256GB and larger, consider utilizing the vm.dirty_bytes and vm.dirty_background_bytes tuning parameters as you can be more granular.

The actual dirty sizing you choose will depend a lot on not just the memory size of the server but also the amount of modified pages your application will be generating, as well as the backing store device (Spinning disk, SSD, NVME etc) and its performance capabilities. Setting the amounts high might result in the application becoming stalled for a few seconds if a large amount of modified Pagecache pages need to be flushed. Whereas setting the amounts too low would also mean that the application could incur a lot more I/O execution time in the kernel than is necessary for small amounts of modified pages being constantly flushed.

I/O scheduler

RHEL 9

In RHEL 9, block devices use multi-queue scheduling. See the documentation: Setting the disk scheduler.

RHEL 8 and earlier

In RHEL 8 and earlier, block devices use single-queue scheduling.

Each of the above articles detail the scheduler recommended and the process for implementing it within the various versions of Red Hat Enterprise Linux.

The Linux operating system supports three I/O schedulers: NOOP, Deadline and CFQ. While the default CFQ (depending on RHEL release) scheduler is usually a good choice, sometimes a performance benefit can be seen by using the Deadline scheduler for file systems containing the DB2 table space containers. This is due to the fact that the Deadline scheduler favors reads versus write operations – and typically databases see more read requests than write requests.

In general, it requires some experimentation to confirm the benefit of this change. However, if your attached disk is coming from a hypervisor, select the noop scheduler.

The above suggestion was taken from the Content from www.ibm.com is not included.IBM Tuning and Monitoring Database System Performance paper.

1

This value does not need to be changed in RHEL 7.
2: This value does not need to be changed in RHEL 7.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.