Pegasus InfoCorp: Web site design and web software development company

21. DB2 UDB and the 2.6 kernel

DB2 UDB Version 8.2 can take advantage of a number of performance enhancements introduced in the 2.6 kernel. There is a good paper by Rav Ahuja, Dan Behman and John Keenleyside that goes in depth on the specific enhancements of DB2 UDB V8.2 (see Resources); we'll cover a few of the highlights and how to implement them.

Note

Note that these enhancements are for advanced users only. Implement each with care and be sure to thorougly test each change individually before moving on to the next enhancement.

  • Asynchronous I/O handling

    Asynchronous I/O is a kernel processing enhancement that allows applications to submit I/O requests, and then continue working without having to wait for the I/O request to be completed.

    As mentioned in a few of the distribution-specific instructions, this requires the installation of the libaio package, and the setting of the DB2LINUXAIO DB2 UDB configuration parameter.

  • Direct I/O caching

    Direct I/O is a different cache writing policy. Instead of using buffered I/O writes, direct I/O caching eliminates the file copying from the file cache to user buffer, thus reducing CPU utilization.

    To enable Direct I/O cache on a database, you specify the NO FILE SYSTEM CACHING parameter for the CREATE, TABLESPACE, ALTER TABLESPACE or CREATE DATABASE commands.

  • Vector I/O

    Vector (or scatter/gather) I/O allows a number of I/O buffers to be used instead of one contiguous buffer, thus avoiding additional copying during reads.

    To enable Vector I/O, set the DB2_SCATTERED_IO configuration parameter to "ON".

  • Large page support

    Large page support allows the application to force the kernel into using larger memory pages, thus reducing the memory overhead required to track the pages, boosting the overall available memory.

    Enabling large page support requires both a 2.6 kernel (or a backported 2.4 kernel like the one in RHEL), and installation of the libcap RPM. Turning on large page support is distribution dependent.

    For SuSE Linux Enterprise 8:

    • During boot-up, add the parameter bigpages=xxxM to the kernel boot command, where xxx is the desired large page size in MB

    • After boot, log in as root and run
      echo 1 > /proc/sys/kernel/shm-use-bigpages
      This will dynamically enable the large page support in the kernel

    • Before running db2start, execute this command to tell DB2 UDB to use the large page configuration:
      db2set DB2_LGPAGE_BP=YES

    For Red Hat Enterprise Linux 3

    • As root, run:
      echo XXX > /proc/sys/vm/hugetlb_pool
      where XXX is a numerical value equivalent to the number of "huge pages" desired. (Red Hat Linux uses "huge" pages instead of large pages). Note also that the size you enter must be available in a contiguous block of memory, otherwise the large page limit will be restricted by the largest block that is available.

    • Check the large page usage by running the command:
      cat /proc/meminfo | grep -i huge

    • Before running db2start, execute this command to tell DB2 UDB to use the large page configuration:
      db2set DB2_LGPAGE_BP=YES

    For Distributions using 2.6 kernel

    • As root, run:
      echo XXX > /proc/sys/vm/nr_hugepages
      where XXX is a numerical value equivalent to the number of "huge pages" desired

    • Check the large page usage by running the command:
      cat /proc/meminfo | grep -i huge

    • Before running db2start, execute this command to tell DB2 UDB to use the large page configuration:
      db2set DB2_LGPAGE_BP=YES