DB2_CPU_BINDING Db2 v11.1 on Linux 64

Mark Baskerville

DB2_CPU_BINDING Db2 v11.1 on Linux 64

We are looking to upgrade to Db2 v11.1 Server Edition in a Virtual Linux 64 bit environment. We have 4 virtual machines which span 13 logical partitions (catalog on server 1, four partitions on each of the three remaining machines).

I'm curious whether anyone has experience in specifying 'NUM_CORES' with 'DB2_CPU_BINDING' in a virtual Linux environment, or if it is even possible due to the nature of virtual servers where resources can be reallocated by the operating system...

Matthew Emmerton

RE: DB2_CPU_BINDING Db2 v11.1 on Linux 64
(in response to Mark Baskerville)

Regardless of what kind of CPU binding mechanism is used at the Db2 level, the bindings will always be subject to actions by the hypervisor.  Furthermore, the benefits of CPU binding depend largely upon the underlying hardware topology and the specific ways in which you're exercising Db2.

Have you experienced performance problems in the past that were improved by the use of resource binding?  Or is this something that you're just interested in trying out?

While DB2_CPU_BINDING is really intended for Db2 pureScale with co-located members and CFs, it can be used in a DPF scenario.  However, you cannot use the NUM_CORES option since the logic for this registry variable does not handle multiple co-located members.  (It will end up assigning the same set of resources to each member.)
Instead, you can use the PROCESSOR_LIST option so that you can specify the CPUs.

e.g.

db2set -i dbi2nst1 0 DB2_CPU_BINDING="PROCESSOR_LIST=13"
db2set -i dbi2nst1 1 DB2_CPU_BINDING="PROCESSOR_LIST=1,2,3,4"
db2set -i dbi2nst1 2 DB2_CPU_BINDING="PROCESSOR_LIST=5,6,7,8"
db2set -i dbi2nst1 3 DB2_CPU_BINDING="PROCESSOR_LIST=9,10,11,12"

You will see entries like this in your db2diag.log files:

DIAG0000/db2diag.log:CPU binding: num cores:0.500 processor list: 13
DIAG0001/db2diag.log:CPU binding: num cores:2.000 processor list: 1 2 3 4
DIAG0002/db2diag.log:CPU binding: num cores:2.000 processor list: 5 6 7 8
DIAG0003/db2diag.log:CPU binding: num cores:2.000 processor list: 9 10 11 12

You will also need to manually interrogate each instance-level registry when listing the current db2set values, as 'db2set -all' won't show them.

$ db2set -i db2inst1 0 -all
[n] DB2_CPU_BINDING=PROCESSOR_LIST=13
$ db2set -i db2inst1 1 -all
[n] DB2_CPU_BINDING=PROCESSOR_LIST=1,2,3,4
$ db2set -i db2inst1 2 -all
[n] DB2_CPU_BINDING=PROCESSOR_LIST=5,6,7,8
$ db2set -i db2inst1 3 -all
[n] DB2_CPU_BINDING=PROCESSOR_LIST=9,10,11,12