Windows Server 2012 on KVM on Ubuntu 14.04. Runs well for a while and then slows down

kvm-virtualizationwindows-server-2012

I have Windows Server 2012 Essentials running as a VM on KVM running on Ubuntu 14.04 LTS.

It performs very nicely after a reboot but after a while it starts slowing down and getting sluggish. This can be after a few hours or a day. I haven't found any obvious pattern between usage and when it slows down.

The Windows VM has three virtual disks, two are LVM and one is a 250 GB VMDK file on an LVM. I intend converting the VMDK file to direct LVM which will presumably help performance a bit but I don't think that is my current problem. We use the latest virtio drivers.

When it slows down, it gets quite bad. A right click on the task bar can take 5 seconds or more before the menu appears. VNC on the host or RDP to the Windows server perform much the same. File share access, DNS etc are all slow for the clients on our LAN.

A reboot of the Windows VM fixes the problem. I don't need to reboot the host.

There are no extra applications running on the Windows server except CloudBerry backup which checks for file changes every four hours. It doesn't seem to be that. It takes a few minutes to scan for changes but if I run it soon after a reboot, the server is still running quickly.

This server provides printing services to network attached printers.

CPU usage of the qemu process on the host creeps up when things slow down. It's always somewhat peaky but I think the peaks get higher and last longer. I don't notice anything particularly unusual in the Windows task manager.

I know Windows on KVM is, of course, not supported by Microsoft so it was always a bit of a gamble. Maybe it was a foolish idea but the installation and early performance has been absolutely perfect.

Any ideas or suggestions? What tools or methods should I be using to track down this problem?

Best Answer

It seems that the issue was a result of a kernel bug in the 3.13 kernel that causes KSM to be a bit over eager when identifying memory to share. (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1341195)

We fixed this by setting KSM_ENABLED in /etc/default/qemu-kvm to 0. Alternatively, we could have upgraded to the 3.14 kernel.

Related Topic