DB2 10.5 for Linux, UNIX, and Windows

db2osconf - Utility for kernel parameter values command

Makes recommendations for kernel parameter values based on the size of a system. The recommended values are high enough for a given system that they can accommodate most reasonable workloads. This command is currently available only for DB2® databases on the Solaris operating system and for 64-bit DB2 instances on HP-UX.

Authorization

Command syntax

To get the list of currently supported options, enter db2osconf -h:
db2osconf -h
Usage:
-c                 # Client only
-f                 # Compare to current
-h                 # Help screen
-l                 # List current
-m <mem in GB>     # Specify memory in GB
-n <num CPUs>      # Specify number of CPUs
-p <perf level>    # Msg Q performance level (0-3)
-s <scale factor>  # Scale factor (1-3)
-t <threads>       # Number of threads

Command parameters

-c
The -c switch is for client only installations. This option is available only for DB2 database systems on Solaris operating systems.
-f
Used to compare the current kernel parameters with the values that would be recommended by the db2osconf utility. The -f option is the default if no other options are entered with the db2osconf command. On Solaris operating systems, only the kernel parameters that differ will be displayed. On HP-UX, the -f option returns a list of recommended parameters and a list of recommended changes to parameter values:
****** Please Change the Following in the Given Order ******

WARNING [<parameter name>] should be set to <value>
-l
Lists the current kernel parameters.
-m
Overrides the amount of physical memory in GB. Normally, the db2osconf utility determines the amount of physical memory automatically. This option is available only for DB2 database systems on Solaris operating systems.
-n
Overrides the number of CPUs on the system. Normally, the db2osconf utility determines the number of CPUs automatically. This option is available only for DB2 database systems on Solaris operating systems.
-p
Sets the performance level for SYSV message queues. 0 (zero) is the default and 3 is the highest setting. Setting this value higher can increase the performance of the message queue facility at the expense of using more memory.
-s
Sets the scale factor. The default scale factor is 1 and should be sufficient for almost any workload. If a scale factor of 1 is not enough, the system might be too small to handle the workload. The scale factor sets the kernel parameters recommendations to that of a system proportionally larger then the size of the current system. For example, a scale factor of 2.5 would recommend kernel parameters for a system that is 2.5 times the size of the current system.
-t
Provides recommendations for semsys:seminfo_semume and shmsys:shminfo_shmseg kernel parameter values. This option is available only for DB2 database systems on Solaris operating systems. For multithreaded programs with a fair number of connections, these kernel parameters might have to be set beyond their default values. They only need to be reset if the multithreaded program requiring them is a local application:
semsys:seminfo_semume
Limit of semaphore undo structures that can be used by any one process
shmsys:shminfo_shmseg
Limit on the number of shared memory segments that any one process can create.

These parameters are set in the /etc/system file. The following section is a guide to set the values, and is what the db2osconf utility uses to recommend them. For each local connection DB2 will use one semaphore and one shared memory segment to communicate. If the multithreaded application is a local application and has X number of connections to DB2 databases, then that application (process) will need X number of shared memory segments and X number of the semaphore undo structures to communicate with the DB2 database system. So the value of the two kernel parameters should be set to X + 10 (the plus 10 provides a safety margin).

Without the -l or -f switches, the db2osconf utility displays the kernel parameters using the syntax of the /etc/system file. To prevent human errors, the output can be cut and pasted directly into the /etc/system file.

The kernel parameters are recommended based on both the number of CPUs and the amount of physical memory on the system. If one is disproportionately low, the recommendations will be based on the lower of the two.

Example

Here is a sample output produced by running the db2osconf utility with the -t switch set for 500 threads. The results received are machine-specific, so the results you receive will vary depending on your environment.
db2osconf -t 500

set msgsys:msginfo_msgmax = 65535
set msgsys:msginfo_msgmnb = 65535
set msgsys:msginfo_msgssz = 32
set msgsys:msginfo_msgseg = 32767
set msgsys:msginfo_msgmap = 2562
set msgsys:msginfo_msgmni = 2560
set msgsys:msginfo_msgtql = 2560
set semsys:seminfo_semmap = 3074
set semsys:seminfo_semmni = 3072
set semsys:seminfo_semmns = 6452
set semsys:seminfo_semmnu = 3072
set semsys:seminfo_semume = 600
set shmsys:shminfo_shmmax = 2134020096
set shmsys:shminfo_shmmni = 3072
set shmsys:shminfo_shmseg = 600

Total kernel space for IPC:
0.35MB (shm) + 1.77MB (sem) + 1.34MB (msg) == 3.46MB (total)
The recommended values for set semsys:seminfo_semume and set shmsys:shminfo_shmseg were the additional values provided by running db2osconf -t 500.

Usage notes

Even though it is possible to recommend kernel parameters based on a particular DB2 database workload, this level of accuracy is not beneficial. If the kernel parameter values are too close to what are actually needed and the workload changes in the future, the DB2 database manager might encounter a problem due to a lack of interprocess communication (IPC) resources. A lack of IPC resources can lead to an unplanned outage for the DB2 database manager and a reboot would be necessary in order to increase kernel parameters. By setting the kernel parameters reasonably high, it should reduce or eliminate the need to change them in the future. The amount of memory consumed by the kernel parameter recommendations is almost trivial compared to the size of the system. For example, for a system with 4 GB of RAM and 4 CPUs, the amount of memory for the recommended kernel parameters is 4.67 MB or 0.11%. This small fraction of memory used for the kernel parameters should be acceptable given the benefits.

On Solaris operating systems, there are two versions of the db2osconf utility: one for 64-bit kernels and one for 32-bit kernels. The utility needs to be run as root or with the group sys since it accesses the following special devices (accesses are read-only):
crw-r-----   1 root     sys       13,  1 Jul 19 18:06 /dev/kmem
crw-rw-rw-   1 root     sys       72,  0 Feb 19  1999 /dev/ksyms
crw-r-----   1 root     sys       13,  0 Feb 19  1999 /dev/mem