Is there any option to limit CPU usage for KVM virtual server?

Have more questions? Submit a request

Applicable to:

  • SolusVM

Question

 Is there any option to limit CPU usage for KVM virtual server?

Answer

KVM has several features that allows perform CPU tuning and limit CPU usage by the particular virtual server.

https://libvirt.org/formatdomain.html#elementsCPUTuning

SolusVM provides an ability to use these features from web interface and tune CPU settings for the KVM virtual server:

  1. Browse to Dashboard > Virtual Servers > xxx - vps_name On the Settings click on CPU tab
    cpu_tune.PNG
  2. Turn on CPU Tune feature and updates parameters as required.
  3. Click on Save button and Re-Configure icon to rebuild configuration XML file
  4. Reboot the virtual server to apply the changes.

Here are some examples of how it can be configured. If it is required to avoid degradation of server performance because of CPU usage by a single VPS, it is possible to pin virtual CPUs of VPS to a particular physical CPU (if this is 8vCPU):

CONFIG_TEXT: <vcpupin vcpu="0" cpuset="0"/>
<vcpupin vcpu="1" cpuset="0"/>
<vcpupin vcpu="2" cpuset="0"/>
<vcpupin vcpu="3" cpuset="0"/>
<vcpupin vcpu="4" cpuset="0"/>
<vcpupin vcpu="5" cpuset="0"/>
<vcpupin vcpu="6" cpuset="0"/>
<vcpupin vcpu="7" cpuset="0"/>

It will make all virtual CPU use a single physical CPU. Note that it will cause slow performance in processing inside of the VM

Also, it is possible to relatively decrease the resource usage comparing with other VPS on the node, using shares directive:

CONFIG_TEXT: <shares>2048</shares>

If this is set as 2048 and there is another VPS that has such parameter set 1024, the first one will receive twice more resources comparing the second.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.