-1

I have a private cloudstack cloud with the following configuration:

host server:

  • ubuntu 14.04
  • KVM hypervisor
  • 2x 2400 MHz CPU (amd athlon 64 X2 Dual Core Processor 4600+)

virtual machines:

  • 1x 500 MHz CPU (RESTRICTED use of 500mhz only by cloudstack)
  • ubuntu 14.04

When i utilize the vm with the stress utility to 100% the cpu of the host shows a utilization of 50%. So the vm is using one full cpu core of the host.

Is this a bug of cloudstack? Maybe of KVM?


UPDATE

this is vm configuration generated by cloudstack:

<domain type='kvm'>
  <name>i-4-118-VM</name>
  <uuid>0c795c99-5bab-46f8-a321-71e3e398036b</uuid>
  <description>Ubuntu 14.04 (64-bit)</description>
  <memory unit='KiB'>512000</memory>
  <currentMemory unit='KiB'>512000</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>500</shares>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <sysinfo type='smbios'>
    <system>
      <entry name='manufacturer'>Apache Software Foundation</entry>
      <entry name='product'>CloudStack KVM Hypervisor</entry>
      <entry name='uuid'>0c795c99-5bab-46f8-a321-71e3e398036b</entry>
    </system>
  </sysinfo>
  <os>
    <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu>
  </cpu>
  <clock offset='utc'>
    <timer name='kvmclock'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm-spice</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/a5bb6304-61f7-3d9e-9706-1f447a6a5fdb/af0c4ab6-aaad-4990-9046-da6ac83a575f'/>
      <target dev='vda' bus='virtio'/>
      <serial>af0c4ab6aaad49909046</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='06:0b:00:00:00:15'/>
      <source bridge='cloudbr0'/>
      <bandwidth>
        <inbound average='25600' peak='25600'/>
        <outbound average='25600' peak='25600'/>
      </bandwidth>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='10.0.0.11' passwd='-'>
      <listen type='address' address='10.0.0.11'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='none'/>
  </devices>
  <seclabel type='none'/>
</domain>

I HOPE SOMEONE CAN HELP OR GOT AN IDEA!

  • If a car has a top speed of 60 mph but you restrict it to 30 mph, you're still using the car 100% of the time when you're going 30 mph. Whatever speed the CPU runs at, if you're using it at that speed, you're using all of it. – David Schwartz Dec 22 '16 at 09:56

1 Answers1

0

The only thing in that XML for the guest that controls CPU usage is <shares>500&;lt;/shares>. This is not doing what you might think it is doing. 'Shares' is a merely relative weighting/prioritization for the guest, wrt other processes. eg if you have 2 guests on the host and one has a shares value of '500' and one has a shares value of '100', then the first guest will get x5 the amount of CPU time as the second guest.

If you want to place absolute caps on the CPU usage, eg to say 50% of a host CPU, then you need to use the <period> and <quota> settings instead. eg period of 1000000 and quota of 500000, will restrict the each vCPU to only use 50% of a host CPU.

DanielB
  • 1,618
  • 7
  • 7