Changes

Jump to navigation Jump to search

Performance Optimization

1,809 bytes added, 02:56, 11 September 2021
<span style="color: red;">'''Note: When hugepages are configured this portion of memory is taken away from the Host. This means the Host will no longer be able to use it. Keep this in mind.'''</span>
=== Debain Debian (Ubuntu/Mint/Lubuntu/PopOS/etc) ===
First check if Linux isn't already using Hugepages with: <code>cat /proc/meminfo | grep Huge</code>.
If the output resembles the following:
== vcpupin ==
vcpupin is the process where-in each vCPU assigned to the VM is tied to a physical core/thread. Configuring this has the most profound impact when dealing with a system that has multiple NUMA Nodes because it forces requests to memory to stay on one nodewithout having to cross Intel's QPI links or AMD's Infinity Fabric. This also helps by tying the vCPUs to the Node that is directly connected to the GPU. <span style="color: red;">'''NOTE: In many cases a function in the BIOS known as Memory Interleave will obfuscate the NUMA Nodes making the system treat multiple sockets or multiple dies as one UMA(Uniform Memory Access) Node. This is a problem for multiple reasons. To fix this find Memory Interleave in your BIOS and set it from Auto -> Channel. If Memory Interleave does not have these options on a single socket system then chances are the system only operates in UMA mode. In such case this is fine.'''</span>
=== Identifying CPU Affinity ===
=== Assigning CPU Affinity ===
To tie cores/threads to a VM open the VM's .XML fileand find the <code>vcpu placement</code> section. Beneath this you will append <code>cputune</code> and modify it's configuration:<syntaxhighlight lang=text><vcpu placement='static'>16</vcpu> <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='8'/> <vcpupin vcpu='5' cpuset='9'/> <vcpupin vcpu='6' cpuset='10'/> <vcpupin vcpu='7' cpuset='11'/> </cputune></syntaxhighlight>CPU tune works on a per thread basis. If NUMA Node 0 or NUMA Node 1 were threads 0-3,8-11 then you would assign these to the VM's vCPU's with the above example.
=== Verifying CPU Affinity ===
To verify if the CPU threads have been successfully pinned to the VM the <code>virsh vcpupin name-of-vm</code> command can be used. The output for a VM with 8 vCPUs configured as above would look like this:
<syntaxhighlight lang=text>
VCPU CPU Affinity
----------------------
0 0
1 1
2 2
3 3
4 8
5 9
6 10
7 11
</syntaxhighlight>
In the event that your system only uses UMA(Uniform Memory Access) the impact of pinning threads is definitely less pronounced but some benefit can still be gained.
Anonymous user

Navigation menu