(LINUX) LINUX (2021)

Optimize KVM host performance by mapping virtual CPU to physical

Assign all cores to KVM is impossible and not workable solution, because no CPU resources to KVM host, therefore need to reserve part of cumulative CPU resource to KVM host, therefore firstly need to understand your CPU structure, for example compare computers below. First computer has 6 core with 2 thread per core, second computer has 4 cores with 1 thread per core, third computer has 8 cores with 1 thread per core and 2 sockets, last computer has 2 sockets with 6 cores and 2 thread for each cores in each sockets.



This is a way to assign VCPU to KVM-host CPU.



And this is workable solution when most of CPU resources is reversed to KVM host. (This is future of TOP command TOP (press 1 to show workload separately per processor).



And this is real example of KVM VM with mapping VCPU to host CPU.


   1:  <domain type="kvm">
   2:    <name>U76</name>
   3:    <uuid>227d6053-75f4-47d3-bf5c-ecaab02478c7</uuid>
   4:    <metadata>
   5:      <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
   6:        <libosinfo:os id="http://ubuntu.com/ubuntu/16.04"/>
   7:      </libosinfo:libosinfo>
   8:    </metadata>
   9:    <memory unit="KiB">2097152</memory>
  10:    <currentMemory unit="KiB">2097152</currentMemory>
  11:    <vcpu placement="static" cpuset="0,6">1</vcpu>
  12:    <os>
  13:      <type arch="x86_64" machine="pc-i440fx-groovy">hvm</type>
  14:    </os>
  15:    <features>
  16:      <acpi/>
  17:      <apic/>
  18:      <vmport state="off"/>
  19:    </features>
  20:    <cpu mode="host-model" check="partial"/>
  21:    <clock offset="utc">
  22:      <timer name="rtc" tickpolicy="catchup"/>
  23:      <timer name="pit" tickpolicy="delay"/>
  24:      <timer name="hpet" present="no"/>
  25:    </clock>
  26:    <on_poweroff>destroy</on_poweroff>
  27:    <on_reboot>restart</on_reboot>
  28:    <on_crash>destroy</on_crash>
  29:    <pm>
  30:      <suspend-to-mem enabled="no"/>
  31:      <suspend-to-disk enabled="no"/>
  32:    </pm>
  33:    <devices>
  34:      <emulator>/usr/bin/qemu-system-x86_64</emulator>
  35:      <disk type="block" device="disk">
  36:        <driver name="qemu" type="raw" cache="unsafe"/>
  37:        <source dev="/dev/sdb11"/>
  38:        <target dev="sda" bus="scsi"/>
  39:        <boot order="2"/>
  40:        <address type="drive" controller="0" bus="0" target="0" unit="0"/>
  41:      </disk>
  42:      <disk type="file" device="cdrom">
  43:        <driver name="qemu" type="raw"/>
  44:        <target dev="hda" bus="ide"/>
  45:        <readonly/>
  46:        <boot order="1"/>
  47:        <address type="drive" controller="0" bus="0" target="0" unit="0"/>
  48:      </disk>
  49:      <controller type="usb" index="0" model="ich9-ehci1">
  50:        <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x7"/>
  51:      </controller>
  52:      <controller type="usb" index="0" model="ich9-uhci1">
  53:        <master startport="0"/>
  54:        <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0" multifunction="on"/>
  55:      </controller>
  56:      <controller type="usb" index="0" model="ich9-uhci2">
  57:        <master startport="2"/>
  58:        <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x1"/>
  59:      </controller>
  60:      <controller type="usb" index="0" model="ich9-uhci3">
  61:        <master startport="4"/>
  62:        <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x2"/>
  63:      </controller>
  64:      <controller type="pci" index="0" model="pci-root"/>
  65:      <controller type="scsi" index="0" model="lsilogic">
  66:        <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
  67:      </controller>
  68:      <controller type="ide" index="0">
  69:        <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
  70:      </controller>
  71:      <controller type="virtio-serial" index="0">
  72:        <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
  73:      </controller>
  74:      <interface type="bridge">
  75:        <mac address="52:54:00:bd:c1:99"/>
  76:        <source bridge="br2"/>
  77:        <model type="virtio"/>
  78:        <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
  79:      </interface>
  80:      <serial type="pty">
  81:        <target type="isa-serial" port="0">
  82:          <model name="isa-serial"/>
  83:        </target>
  84:      </serial>
  85:      <console type="pty">
  86:        <target type="serial" port="0"/>
  87:      </console>
  88:      <channel type="spicevmc">
  89:        <target type="virtio" name="com.redhat.spice.0"/>
  90:        <address type="virtio-serial" controller="0" bus="0" port="1"/>
  91:      </channel>
  92:      <input type="tablet" bus="usb">
  93:        <address type="usb" bus="0" port="1"/>
  94:      </input>
  95:      <input type="mouse" bus="ps2"/>
  96:      <input type="keyboard" bus="ps2"/>
  97:      <graphics type="spice" autoport="yes" listen="0.0.0.0">
  98:        <listen type="address" address="0.0.0.0"/>
  99:      </graphics>
 100:      <sound model="ich6">
 101:        <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
 102:      </sound>
 103:      <video>
 104:        <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
 105:        <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
 106:      </video>
 107:      <redirdev bus="usb" type="spicevmc">
 108:        <address type="usb" bus="0" port="2"/>
 109:      </redirdev>
 110:      <redirdev bus="usb" type="spicevmc">
 111:        <address type="usb" bus="0" port="3"/>
 112:      </redirdev>
 113:      <memballoon model="virtio">
 114:        <address type="pci" domain="0x0000" bus="0x00" slot="0x08" function="0x0"/>
 115:      </memballoon>
 116:    </devices>
 117:  </domain>


Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: //www.vb-net.com/MapKvmCpu/Index.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>