Hello List,
how can I achieve the best performance with vcpu pinning in KVM?
Is it better to have 1:1 mapping between virtual and physical thread like this:
<vcpupin vcpu='0' cpuset='0'/>
<vcpupin vcpu='1' cpuset='1'/>
<vcpupin vcpu='2' cpuset='2'/>
<vcpupin vcpu='3' cpuset='3'/>
<vcpupin vcpu='4' cpuset='4'/>
<vcpupin vcpu='5' cpuset='5'/>
<vcpupin vcpu='6' cpuset='6'/>
<vcpupin vcpu='7' cpuset='7'/>
Or is it better to allow each vCPU to run on any of the limited number of physical
threads?
e.g.
<vcpupin vcpu='0' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='1' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='2' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='3' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='4' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='5' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='6' cpuset='0,1,2,3,4,5,6,7'/>
<vcpupin vcpu='7' cpuset='0,1,2,3,4,5,6,7'/>
The hypervisor host has 2 CPUs. Each CPU has 8 cores and each core 2 Threads. In total
this are 32 threads.
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz
Stepping: 7
CPU MHz: 4213.731
CPU max MHz: 4400.0000
CPU min MHz: 1200.0000
BogoMIPS: 7200.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 25344K
NUMA node0 CPU(s): 0-7,16-23
NUMA node1 CPU(s): 8-15,24-31
I need to run 2 VMs on this host. One is for production and should have 24 vCPUs and the
other one is for test and should have 8 vCPUs. Test VM workload should not impact Prod VM
performance.
Current configuration is:
TEST:
<vcpu placement='static' current='8'>128</vcpu>
<iothreads>1</iothreads>
<cputune>
<vcpupin vcpu='0' cpuset='0'/>
<vcpupin vcpu='1' cpuset='1'/>
<vcpupin vcpu='2' cpuset='2'/>
<vcpupin vcpu='3' cpuset='3'/>
<vcpupin vcpu='4' cpuset='4'/>
<vcpupin vcpu='5' cpuset='5'/>
<vcpupin vcpu='6' cpuset='6'/>
<vcpupin vcpu='7' cpuset='7'/>
</cputune>
<cpu mode='host-passthrough' check='none'>
<topology sockets='16' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='134217728'
unit='KiB'/>
</numa>
</cpu>
PROD:
<vcpu placement='static' current='24'>192</vcpu>
<iothreads>1</iothreads>
<cputune>
<vcpupin vcpu='0' cpuset='8'/>
<vcpupin vcpu='1' cpuset='9'/>
<vcpupin vcpu='2' cpuset='10'/>
<vcpupin vcpu='3' cpuset='11'/>
<vcpupin vcpu='4' cpuset='12'/>
<vcpupin vcpu='5' cpuset='13'/>
<vcpupin vcpu='6' cpuset='14'/>
<vcpupin vcpu='7' cpuset='15'/>
<vcpupin vcpu='8' cpuset='16'/>
<vcpupin vcpu='9' cpuset='17'/>
<vcpupin vcpu='10' cpuset='18'/>
<vcpupin vcpu='11' cpuset='19'/>
<vcpupin vcpu='12' cpuset='20'/>
<vcpupin vcpu='13' cpuset='21'/>
<vcpupin vcpu='14' cpuset='22'/>
<vcpupin vcpu='15' cpuset='23'/>
<vcpupin vcpu='16' cpuset='24'/>
<vcpupin vcpu='17' cpuset='25'/>
<vcpupin vcpu='18' cpuset='26'/>
<vcpupin vcpu='19' cpuset='27'/>
<vcpupin vcpu='20' cpuset='28'/>
<vcpupin vcpu='21' cpuset='29'/>
<vcpupin vcpu='22' cpuset='30'/>
<vcpupin vcpu='23' cpuset='31'/>
</cputune>
<cpu mode='host-passthrough' check='none'>
<topology sockets='16' cores='6' threads='2'/>
<numa>
<cell id='0' cpus='0-23' memory='889192448'
unit='KiB'/>
</numa>
</cpu>
Versions are:
ovirt-host-4.3.5
libvirt-5.7.0-28.el7.x86_64
Thanks in advance,
Martin