VM Not utilizing full core on the host & core binding not working

Anotheruser

Member
Sep 21, 2022
70
19
8
Hi,
we installed a new hostsystem a couple weeks ago but have some performance issues in certain vms.
The hostsystem is on 7.4-15 with Kernal 5.15.108-1 and it is primarily used for game / csgo servers. We are running a Ryzen 1700x, 64g ram and 2x 1tb nvme zfs raid1. Inside the vm we run ubuntu server 22 with pterodactyl / docker for the gameservers. The vm has 6 cpu threads and is set to type host.

The first thing we tested was shutting down all other vms on the host which did improve the performance a bit but not even close to where it should be / is on similar hostsystems / setups. Next we tried setting cpu affinity to 0-2,8-10 which should force the vm on the host cpu cores 0, 1 & 2 (the second thread of those physical cores is 8-10 not 3-5), but that didnt change anything.

After additional testing we found out two thing,
- first, it is ignoring the cpu core bind / affinity and always uses threads 0-5 for the vm no matter what is entered (did run stress inside the vm to verify)
- second, it is barely using 50% on any of the assigned host cpu cores even when inside the vm a thread is at 100% see image 1 and 2, on both images the top htop is the host, the bottom one inside the vm and they where taken at the exact same time with htop refreshing 5x/sec, also keep in mind cores 3-5 and 11-13 where assigned to a different vm running a stress test and cores 0-2,8-10 to the problem vm. The problems vm config below images.

  1. Why is it ignoring affinity and using hostcore 0-5 instead of 0-2,8-10?
  2. Just for my understanding, each vcore from the vm should have its own progeam thread on the hostsystem, meaning technically a virtual core should be able to use 100% of a hostsystem core, if there is running nothing else on that hostsystem core, correct?
  3. Also spreading one vm vcore across two or more hostsystem cores to increase vm single core performance is not possible, correct?
  4. So it is not possible if you look at image1 that the 100% maxed out vm thread was just spread out across hostsystem cores 0-2, correct?

This setup is close to driving me nuts after close to a week of troubleshooting, any help appreciated :)


image 1
Screenshot_20230820_192156.png

image 2
Screenshot_20230820_192113.png

VM Config Problem VM
Code:
affinity: 0,1,2,8,9,10
boot: order=scsi0;net0
cores: 6
cpu: host
memory: 9000
meta: creation-qemu=7.1.0,ctime=1671810453
name: Redacted-22-server
net0: virtio=RE:PL:AC:ED:00:00,bridge=vmbr2,firewall=1
numa: 0
onboot: 1
ostype: l26
scsi0: local-zfs:vm-3153-disk-0,discard=on,iothread=1,size=200G,ssd=1
scsihw: virtio-scsi-single
smbios1: uuid=redacted
sockets: 1
vmgenid: redacted
 
1. Why is it ignoring affinity and using hostcore 0-5 instead of 0-2,8-10?
I don't know. There are also one or more threads for disk and network I/O and other emulation and (para-)virtualization.
2. Just for my understanding, each vcore from the vm should have its own progeam thread on the hostsystem, meaning technically a virtual core should be able to use 100% of a hostsystem core, if there is running nothing else on that hostsystem core, correct?
Sort of, each virtual CPU has a program thread on the host system but that software thread is not bound to any specific physical CPU/core/thread. I assume the physical CPU/cores/threads on which it can run would be limited to the affinity group specified.
3. Also spreading one vm vcore across two or more hostsystem cores to increase vm single core performance is not possible, correct?
Yes, you cannot get faster single threads in a VM than the physical single threads. There might also be some overhead.
4. So it is not possible if you look at image1 that the 100% maxed out vm thread was just spread out across hostsystem cores 0-2, correct?
No, it is possible that your virtual thread is moved from one physical thread to another physical thread by the Linux scheduler under the hood of Proxmox, while executing instructions for your VM. This is not related to your previous questions.
 
  • Like
Reactions: Anotheruser

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!