Everyone wants to get the best performance out of their virtual machine. There is a lot of talk about CPU Pinning and the performance gains that come along with it. These benchmarks are to give you an idea of the performance changes you can expect from various setups people may recommend.
Read also: Meltdown Patch Performance Benchmarked
A Quick Overview
In short, CPU pinning is the process of pairing a Virtual CPU to a physical CPU. This is to make sure processes that run on a certain VCPU will be run on the physical CPU that you have determined. This can have its benefits. For example, if you have separate NUMA nodes you can keep your virtual machines on one node to ensure there is no unnecessary latency. With that in mind, does it increase performance in a VM that’s using a standard consumer processor? That’s what we are here to find out.
The Benchmarked System
The following hardware hosted these benchmarks:
- Intel Core i7-4790K @ 4.7 GHz 4c/8t
- ASUS Z97-A
- 2x8GB Corsair Vengeance Pro DDR3 @ 2400MHz
- 1TB Samsung 850 EVO
- ASUS GeForce GTX 1080 8G ROG STRIX
The Benchmarked Software
The following software hosted these benchmarks:
- Debian Unstable/Sid
- Linux 4.14.12
- QEMU 2.11.0
- Libvirt 4.0.0
- Windows 10 1709 (Fall Creators Update) guest
The Different Benchmarks
- No Pin is as it sounds, no CPUs pinned with 8 VCPUs given to the VM. This is our baseline
- Full Pin is pinning all 8 threads
- No Pin Core 0 is pinning everything except for core 0 and its thread. 6 threads total
- 1 Thread per Core is pinning every core but not their threads. 4 threads total
- Half Cores Both Threads is pinning 2 cores and their threads. 4 threads total
- SharkWipf Setup is pinning every core except for core 0 and its thread, putting iothreads on core 0 and its thread and enabling isolcpus on all pinned cores. Isolcpus makes it so only qemu utilizes the listed cores. 6 threads total
With this I did a basic benchmark of compressing a folder of 15,997 files totaling 9.34 GB. Lower is better.
In this benchmark you can clearly see that No Pin or Full Pin is the winner. Half Cores Both Threads lost hard, and the other 3 tests are neck and neck with each other. It appears that with 7Zip, isolcpus had no impact on the processors performance.
This is the average Cinebench test. higher is better
This benchmark looks a lot like the 7Zip one. Our No Pin and Full pin are still winning while Half Cores Both Threads is losing. Isolcpus also seems to have no impact on performance.
I chose this game to benchmark as it is the most demanding game that I had installed at the moment. I used FRAPS for the benchmark.
What is interesting about this benchmark is how it doesn’t follow the previous two at all. It appears for gaming performance the SharkWipf setup is coming out on top, followed closely by the 1 Thread per Core.
If all you’re doing is playing games in your virtual machine then it seems there could be some FPS gain by doing some tweaking. For pure CPU performance it’s clear that either No Pinning or Full Pinning is the choice.
Images Courtesy Pixabay