xen vcpu pinning defaults aren’t ideal
I noticed an oddity the other day with a xen Domain0 host we have. There’s a cron scripted job that verifies the RPM database and the RPM’s that are installed on the system, for some reason this job failed, but kept the process open, and kept spinning around trying to do it’s job. Now, I really ought to have set up a “process count” check on the nagios monitoring we have here, but I didn’t have this at the time, so didn’t pick it up for a few days. Whilst this was all going on, the Domain0 got pretty busy and started having to use time on the other CPU’s as well as the main VCPU that wasn’t pinned to anything but the Domain0.
You can see this from the list below of the vcpu resources used by a xen server currently:
[root@somedomain0 ~]# xm vcpu-list
Name ID VCPUs CPU State Time(s) CPU Affinity
Domain-0 0 0 0 -b- 1535018.3 0
Domain-0 0 1 1 -b- 139549.6 1
Domain-0 0 2 2 -b- 943651.0 2
Domain-0 0 3 3 -b- 53883.4 3
Domain-0 0 4 4 -b- 336268.9 4
Domain-0 0 5 5 -b- 65240.1 5
Domain-0 0 6 6 -b- 42854.6 6
Domain-0 0 7 7 r– 67960.9 7
domain1 4 0 2 r– 1791844.4 1-2
domain1 4 1 1 r– 1619120.1 1-2
domain2 5 0 3 -b- 511300.0 3-5
domain2 5 1 3 -b- 456253.1 3-5
domain2 5 2 5 -b- 456516.1 3-5
domain3 6 0 6 -b- 166344.6 6-7
domain3 6 1 7 -b- 137435.2 6-7
You’ll see Domain-0 which is the control domain, is pinned to all the other cpu’s that should only be used by the guests.
This isn’t ideal, and as a result you find that usually instead of a vmstat looking quite healthy and the “steal %” value that shows up being at 0, it’ll start to creep up. This means that the scheduler on the Domain0 side is interrupting the VCPU and requires CPU time from it, interrupting whatever is happening on the DomainU side.
There is a vcpu-pin action available within the xm command, which isn’t ideal to be used when you have the server live. What I found best, was to change the boot configuration for the Domain0 from the following:
title Enterprise Linux (2.6.18-128.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-128.el5
module /vmlinuz-2.6.18-128.el5xen ro root=/dev/vg01/root console=tty0 rhgb quiet
module /initrd-2.6.18-128.el5xen.img
To the following:
title Enterprise Linux (2.6.18-128.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-128.el5 dom0_max_vcpus=1
module /vmlinuz-2.6.18-128.el5xen ro root=/dev/vg01/root console=tty0 rhgb quiet
module /initrd-2.6.18-128.el5xen.img
You’ll notice the option dom0_max_vcpus=1, this tells the Domain0 to pin to only one available VCPU, the one it’ll choose should be the first one.
You’ll see a difference in the vcpu-list afterwards like this:
[root@somedomain0 ~]# xm vcpu-list
Name ID VCPUs CPU State Time(s) CPU Affinity
Domain-0 0 0 0 r– 54.0 0
domain1 3 0 7 -b- 3.2 6-7
domain1 3 1 6 -b- 3.0 6-7
domain2 1 0 1 -b- 10.3 1-2
domain2 1 1 2 -b- 2.9 1-2
domain3 2 0 3 -b- 3.7 3-5
domain3 2 1 4 -b- 2.5 3-5
domain3 2 2 5 -b- 0.9 3-5
It’s worth noting that you can also limit this on the fly, by using the following command:
xm vcpu-pin Domain0 0 0
Which can be useful if you can’t get the down time for a box and it’s guests.
Tags: geek, Linux, xenSeptember 1, 2009 at 11:11 pm Comments (0)