Calculating PVUs for IBM DB2 on Linux
DBAs do not have to calculate PVUs(Processor Value Units) often. Many times there is a system administrator or someone else who might do this for us. Or if you’re buying everything from IBM, then they’re likely to calculate it. You may also easily be able to get the information you need from your hardware vendor and skip right to the last section on converting the hardware details into PVUs.
Note: Please verify any advice here with IBM before relying upon the PVU count you come up with. I could be wrong on some of the details, especially with the vast variety in environments. This is meant for ballpark/estimating only.
I’ll describe how to find the information and do the calculations for Linux. There will be differences for UNIX and Windows, though some of the details here may help you if you’re using other operating systems.
The system the examples in this post are on is Red Hat Enterprise Linux Server 6.6
You do not need root for the commands I share in this post – I’ve run everything as the DB2 instance owner. If you don’t have DB2 installed, the system commands here will still function just fine as other users.
What Information is Needed to Calculate PVUs?
The information needed is:
- Type of processor
- Total number of processors
- Number of processors per socket
- Number of sockets on the server
What Kind of Processors Does This Server Have?
It is not just a matter of counting the number of processors you have. Different processors have different PVU values assigned. To find what kind of processors you have, you can use this:
$ more /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 47 model name : Intel(R) Xeon(R) CPU E7- 4830 @ 2.13GHz stepping : 2 microcode : 55 cpu MHz : 1064.000 cache size : 24576 KB physical id : 0 siblings : 16 core id : 0 cpu cores : 8 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdt scp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmp erf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pci d dca sse4_1 sse4_2 x2apic popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi f lexpriority ept vpid bogomips : 4256.40 clflush size : 64 cache_alignment : 64 address sizes : 44 bits physical, 48 bits virtual power management:
That is the output for just one CPU on a multi-core system. The part in red is the main part you’re looking for here.
How Many Sockets Does This Server Have?
You’ll also need to know how many sockets you have. It is also in /proc/cpuinfo – the physical_id tells you which socket each processor belongs to. An easy command to strip that number out is:
$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 2
Thanks to this excellent blog entry for details on that: http://www.ixbrian.com/blog/?p=64
How Many Processors Does This Server Have?
There are several ways you can calculate the number of processors. The output from the above will actually tell you if you just page through all of it. But my favorite is using db2pd:
$ db2pd -osinfo Operating System Information: OSName: Linux NodeName: dbserver.example.com Version: 2 Release: 6 Machine: x86_64 Distros: Red Hat Enterprise Linux Server 6.6 CPU Information: TotalCPU OnlineCPU ConfigCPU Speed(MHz) HMTDegree Cores/Socket 32 32 32 1064 2 8 Physical Memory and Swap (Megabytes): TotalMem FreeMem AvailMem TotalSwap FreeSwap 129007 115904 n/a 64000 64000 Virtual Memory (Megabytes): Total Reserved Available Free 193007 n/a n/a 179904 ..
Now some of the numbers here can be slippery, and some can be changed in odd ways. The
HMTDegree (two in the output above) tells the server to treat physical CPUs as more than one CPU. In many cases this can increase the efficiency of use of the CPUS, and I’ve seen it as high as 4, though I hear it is rare to make it more than two. This is called hyperthreading. What that number tells me to do is to take the number of CPUs reported as
OnlineCPU and divide it by the
HMTDegree, in this case, by 2. This server appears to have 16 cpus. It is also important to note the
Cores/Socket as that could make a difference when calculating the PVUs for a server.
You can verify this conclusion, if you like using this command:
$ cat /proc/cpuinfo | egrep "core id|physical id" | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc -l 16
Thanks again to http://www.ixbrian.com/blog/?p=64 for that syntax.
Converting Gathered Information into PVU Values
Once you know the type of Processor, the number of processors, the number of processors per socket, and the number of sockets, you’re ready to refer to IBM’s table for calculating PVUs. For Linux, you’ll want “PVU Table Per Core (section 2 of 2 – x86)”. This table will change over time. As of the writing of this article, it looks like this:
Based on the output above, I’m in the top row of Xeon (of 2), and one of the bottom few entries in that row. I don’t know which of the following it is, but they all have the same rules:
E7-4800 to 4899V3 E7-4800 to 4899 E7-4800 to 4899V2 E7-4800 to 4899V3
Also, there seem to be two entries in there for
E7-4800 to 4899V3. I’m not sure why.
I know that I have 8 cores per socket from the db2pd output, and that I have 2 sockets. Following the lines for that, I can see that these CPUs are 70 PVUs each.
16 CPUs at 70 PVUs each calculates to 1120 PVUs for this server. In this case, there’s an additional 100 PVUs for each of two HADR standbys, so this client needs a total of 1320 PVUs.
IBM also offers the PVU calculator. Once you’ve gathered the information above, you can try it. I find it a bit on the confusing side. For the example above, I couldn’t just select “Intel Xeon”, but had to select “Intel Xeon 1 or 2 socket”. How I’m supposed to know that, I have no idea. Based on the examples in this post, here are the values I filled in and the results I got:
Exactly the same value as I came up with consulting the table.
One note, if you’re considering buying DB2 licensing – having an expert helping you interface with IBM can save you a lot of money. If you need DB2 licenses (or other IBM licensing), I know someone good and ethical who can help. Contact me and I can put you in touch.