VM CPU settings

TheJM

Member
May 3, 2019
45
1
8
32
Hey guys,

I am somewhat new to Proxmox so please forgive the simple questions but I couldn't find the answers to them anywhere.

I am running a 9900k CPU that has hyperthreading. If i run lscpu in the Proxmox shell it lists 8 cores, 16 threads, 1 socket.

In the CPU part of the hardware section for a VM there is an option for CPU Cores, if i set that setting to 2 then is that 2 physical cores (4 threads) or is that 1 core (2 threads)?

Also under the CPU type i don't see coffee lake listed so i have it set to the default (KVM64 i believe). Should this be set to something else?

Thanks in advance!
 
Hi TheJM

Im from a VMware background so can help with their best practise for cores and sockets.

A thread is not a core its just another data path to a core.
VMware best practise should be equal number of sockets and real physical cores (not threads).

If you only have 1 socket then the config should be 1 socket in the VM.
If you have 2 socket then can have either 1 or 2 sockets in the VM.

Check with the manufacturer probably intel as to haw many physical cores the CPU has.

If its 12 then an example would be.

1 socket = from 1-12 real cores.

If you have 2 sockets and 12 cores per socket = 24 cores

Example config for a 4 CORE vm.
2 sockets
2 cores
= 4 vCPU

Equal amount of cores per socket.

Rules:
  • Never allocate more real cores than you actually have as this will crate added wait time to process a request
  • Never allocate more physical sockets than you actually have.
  • Never allocate more cores per socket 1 socket 4 real cores = VM can have a max of 1 socket 4 cores.
There are a few more rules but the above will keep you on the straight and narrow to get the ball rolling.

If anyone believes this is different for KVM happy to be corrected, as far as im aware this should apply to any hypervisor because it takes into account the max possible value per socket and cores as hyperthreading isn’t a core its a data path to speed up processing.

“”Cheers
G
 
Hi TheJM

Im from a VMware background so can help with their best practise for cores and sockets.

A thread is not a core its just another data path to a core.
VMware best practise should be equal number of sockets and real physical cores (not threads).

If you only have 1 socket then the config should be 1 socket in the VM.
If you have 2 socket then can have either 1 or 2 sockets in the VM.

Check with the manufacturer probably intel as to haw many physical cores the CPU has.

If its 12 then an example would be.

1 socket = from 1-12 real cores.

If you have 2 sockets and 12 cores per socket = 24 cores

Example config for a 4 CORE vm.
2 sockets
2 cores
= 4 vCPU

Equal amount of cores per socket.

Rules:
  • Never allocate more real cores than you actually have as this will crate added wait time to process a request
  • Never allocate more physical sockets than you actually have.
  • Never allocate more cores per socket 1 socket 4 real cores = VM can have a max of 1 socket 4 cores.
There are a few more rules but the above will keep you on the straight and narrow to get the ball rolling.

If anyone believes this is different for KVM happy to be corrected, as far as im aware this should apply to any hypervisor because it takes into account the max possible value per socket and cores as hyperthreading isn’t a core its a data path to speed up processing.

“”Cheers
G


Thank you for your response. I gathered from your response that there is no way to allocate a VM or container 1 thread? You have to allocate it an entire core? If so, does that mean there is no benefit to hyper threading?
 
Thank you for your response. I gathered from your response that there is no way to allocate a VM or container 1 thread? You have to allocate it an entire core? If so, does that mean there is no benefit to hyper threading?

So might have just answered my own question. I was reading this thread and so I went to the node summary. I noticed that it said using 1.48% of 16 CPU(s). My processor has 8 cores, 16 threads so it sounds like the CPU allocation in the VM config is threads, not cores. Someone can correct me if I am wrong but this seems to make sense based on this info.
 

Attachments

  • Screen Shot 2019-09-10 at 9.26.59 AM.png
    Screen Shot 2019-09-10 at 9.26.59 AM.png
    21.9 KB · Views: 97
Technically speaking, you would assign it one vCPU, which is for the most part represents 1 QEMU thread on the host and show up as 1 core inside VM. Unless we talking about CPU pinning.
 
Technically speaking, you would assign it one vCPU, which is for the most part represents 1 QEMU thread on the host and show up as 1 core inside VM. Unless we talking about CPU pinning.
You are correct. I apologize, my terminology is probably incorrect but what you stated is correct.
 
So might have just answered my own question. I was reading this thread and so I went to the node summary. I noticed that it said using 1.48% of 16 CPU(s). My processor has 8 cores, 16 threads so it sounds like the CPU allocation in the VM config is threads, not cores. Someone can correct me if I am wrong but this seems to make sense based on this info.

It’s up to you if you wish to assign more than amount of real cores and sockets go for it.
Just remember it will not perform optimally and you’ll see a lot of high cpu and think its stuck processes.

One more time.

Hyperthreading is multiple paths to the same cpu core 2 data paths 1 core so in theory it looks like you have 2 cores but it’s actually 1 physical core.

Don’t take my word for it do some research to be better informed, research is the key ;)
https://whatis.techtarget.com/definition/Hyper-Threading

If you allocate more cores and sockets than you physically have then this creates more cpu wait time as the cores allocated don’t actually exist.

Forget about the marketing hype.

For example the new AMD epyc 72xx cpus have 32 physical cores which are much better than Intels 12 real cores hyperthreaded to give you the perceived presence of 24 vCPU. They just don’t exist and are only data paths.

Good luck!

“”Cheers
G
 
It’s up to you if you wish to assign more than amount of real cores and sockets go for it.
Just remember it will not perform optimally and you’ll see a lot of high cpu and think its stuck processes.

One more time.

Hyperthreading is multiple paths to the same cpu core 2 data paths 1 core so in theory it looks like you have 2 cores but it’s actually 1 physical core.

Don’t take my word for it do some research to be better informed, research is the key ;)
https://whatis.techtarget.com/definition/Hyper-Threading

If you allocate more cores and sockets than you physically have then this creates more cpu wait time as the cores allocated don’t actually exist.

Forget about the marketing hype.

For example the new AMD epyc 72xx cpus have 32 physical cores which are much better than Intels 12 real cores hyperthreaded to give you the perceived presence of 24 vCPU. They just don’t exist and are only data paths.

Good luck!

“”Cheers
G


Thank you for the response and for the information. I will read it.

I didn't mean for my above post to sound like I was ignoring you. I am right in the middle of 3 time sensitive projects that involve my Proxmox server and just wanted to make sure I didnt break anything. When I get a chance to breathe in a week or so I will read that information and get more informed about this topic.

thanks again!
 
  • Like
Reactions: velocity08

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!