Introduction

I run my labs on an Ubuntu 1604 host using KVM for the hypervisor and some of the network VM images (Cisco CRS1000v, Juniper vMX, etc..) run with very high CPU. A recent thread on Twitter helped me to find a solution to this problem so I will outline it here as it may be helpful for others.

For reference the following software was used in this post.

  • Ubuntu - 1604
  • KVM - 2.5.0

The Question

Tony E @showipintbri asked the following question to the twitterverse regarding running the CSR1000v in eve-ng (which uses KVM as its hypervisor).

twitter-1

The Solution

@Kroupouk666 was kind enough to offer a potential solution which involves setting the KVM halt_poll_ns parameter to 0.

twitter-2

I run my labs with Vagrant using the libvirt provider and I have been using Vagrant triggers to throttle the CPU of these type of hosts that run with very high CPU. This potential solution, if it works, is much more agreeable so I figured I'd give it a try. First I checked the existing value which was 200000 and apparently the default.


cat /sys/module/kvm/parameters/halt_poll_ns

# output
200000
          

Next up I changed the value to 0 as suggested.


echo 0 | sudo tee /sys/module/kvm/parameters/halt_poll_ns

# output
0
          

Incredibly it worked! I found that on the vMX and CSR1000v the CPU usage went from 100% on 2x CPUs down to around 30% which is a huge improvement. Also there was no need to reboot the host which was a plus. The below illustrates the difference between the before and after CPU usage.

Before

vmx-cpu-before

After

vmx-cpu-after

Apparently Cisco provided the solution to @Kroupouk666 as a result of him filing a bug.

twitter-3

Summary

The power of the community helped me to solve an issue that has been bugging me for some time. Thank you very much to @showipintbri for asking the question and @Kroupouk666 for providing the solution.

Links

https://twitter.com/showipintbri/status/1035899052808912896
https://twitter.com/Kroupouk666/status/1035930275774115841
https://twitter.com/Kroupouk666/status/1036271575421603842






















Published: 2018-09-08