Jump to content

unRAID dedicated core

Go to solution Solved by leadeater,

Couple of things, applies not just to unRAID:

  • Hypervisors (virtual hosts) don't distinguish cores vs threads when assigning resources to VMs. You give them vCPUs and the hypervisor will manage the required CPU demand and gives the VM what it needs when it needs it. This is a basic explanation but you don't give a core or thread to a VM specifically, as in you don't give it 2 cores and 1 thread you give it 3 vCPUs and where the vCPUs run is up to the hypervisor.
  • You can override the above behavior and do specific assignments but this is generally advised against as more often than not it isn't required to be done and you'll do a worse job than the hypersior can do balancing the load itself.
  • Over provisioning cores is completely normal for servers, typically between 2:1 to 8:1 or even higher in rare and very specific cases. The majority of games don't use all the CPU power available so it is possible to assign say 8 vCPUs to two VMs on a 4c/8t system, however there are other factors to consider (explanation below).

Hypervisor CPU cycle scheduling:

One of the roles a hypervisor has to do, the most important role, is to managed the CPU resources of the physical system for use by itself and any active virtual machines. Each provisioned and active (powered on) virtual machine has a configured vCPU amount and these need to be scheduled to pCPU threads all at once, the more vCPUs assigned the harder it is to schedule pCPU time for the VM. Even if the VM is very idle and is only doing small background OS tasks if you give the VM 6 vCPUs the hypervisor must give it 6 pCPU threads even if only 1 vCPU is active within the VM, there are no half measures it's all or nothing.

 

There are two main reasons why over provisioning of CPU resources works in server environments: 

  • Most servers are idle the majority of the time and rarely go above 40% CPU
  • Virtual machines only get assigned a fraction of the total CPU resources

These two reasons mean even though you might assign 32 vCPUs in total across all VMs on the host which only has 8 pCPU threads no VM is left starved for CPU time and everything runs nice and smoothly.

 

Where this starts to break down is when you assign too many VMs too many vCPUs or when VMs start to consistently demand full utilization of their vCPUs, 100% guest VM activity. This is why the advice is to only assign the number of vCPUs that is actually required, start with less not more if unknown. By over sizing your VMs you will actually get less performance in the individual VM itself which then also means EVERY other VM on the host will have less performance, don't pee in the pool :P.

 

What does this mean for you? Well you could assign all 8 pCPUs to two VMs and most of the time this would work well, where it wouldn't would be in CPU demanding games or when rendering. You could give 1 VM 8 vCPUs and the other VM 4vCPUs, or 7 vCPU and 4 vCPU, or any combination that you think is right and tested/benchmarked to confirm 

 

In saying this what I would actually recommend is getting used parts and build a cheap secondary system, older generation Intel CPUs are still amazingly good and go for very low prices. You can even get the Xeon equivalent part to the desktop model for less and use it in a standard motherboard and normal RAM. With this you get predictable and stable performance for both users at a reasonable price and when not in use you can shut down the secondary system.

 

Desktop virtualization for home users doesn't generally work all that well due to the low number of CPU threads that can be assigned and usability/compatibility issues that are a real issue. It's not as simple as the videos Linus made makes out and you cannot guarantee stability/compatibility now and in to the future, one small change by Intel/AMD/Nvidia/PCIe/USB could stop unRAID being able to do what you want it to. This could come in the form of any product or technology update meaning for example you couldn't upgraded to the latest GPU as it doesn't work that way anymore, unlikely but never a problem in a dedicated system (without something like AGP to PCIe technology transition).

How important is it to use dedicated CPU core just for unRAID?

What would happen if I don't dedicate 1 CPU core just for it?

 

I have PC with i7 4790k and single GTX 1070. I want to share this PC with my girlfrind, so I just buy her new monitor and we can both use this PC at the same time.

I could also go for 2 users at the same time on Windows 10, without unraid, but I didn't manage to get that working.

 

And if I dedicate 1 core just for unraid, I get 3c/6t CPU, and that just wouldn't be okay for me lol

 

So, what would happen if I don't dedicate 1 core for unraid and CPU goes up to 100% load for long period of time?

Intel i7 12700K | Gigabyte Z690 Gaming X DDR4 | Pure Loop 240mm | G.Skill 3200MHz 32GB CL14 | CM V850 G2 | RTX 3070 Phoenix | Lian Li O11 Air mini

Samsung EVO 960 M.2 250GB | Samsung EVO 860 PRO 512GB | 4x Be Quiet! Silent Wings 140mm fans

WD My Cloud 4TB

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/
Share on other sites

Link to post
Share on other sites

I remember Linus saying in one video that leaving a core unassigned benefits performance somehow, but I've not seen any evidence for that.

KVM has a layer of abstraction between physical cores and virtual ones, so you're not handing off cores and it's why you can have 10 VMs running on a dual core CPU. The general advice I see handed out for servers is that you don't want to give any one machine more vCPUs than the host actually has, so you might even give each VM 4c/8t if you're not going to be putting high loads on each concurrently.

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747017
Share on other sites

Link to post
Share on other sites

20 minutes ago, Ronda said:

I remember Linus saying in one video that leaving a core unassigned benefits performance somehow, but I've not seen any evidence for that.

KVM has a layer of abstraction between physical cores and virtual ones, so you're not handing off cores and it's why you can have 10 VMs running on a dual core CPU. The general advice I see handed out for servers is that you don't want to give any one machine more vCPUs than the host actually has, so you might even give each VM 4c/8t if you're not going to be putting high loads on each concurrently.

But do you have to set how many cores can one VM take?

My girlfriend wouldn't be using CPU heavy tasks, but if there is an option, I would just let unraid decide what to use cores for.

 

So for example, if I tr to render something with my CPU, I can use like 90% of CPU. The rest 10% are left for her browsing on the web.

But if she decides to do something more CPU heavy, while I don't need CPU power, she could take 90% of CPU or something like that. 

 

What happens if we both try to use high CPU power? What would happen if both VMs would start doing some heavy CPU tasks? Would each one of us get around 50% of CPU time, or one would get most of it, and another one would have to wait?

Intel i7 12700K | Gigabyte Z690 Gaming X DDR4 | Pure Loop 240mm | G.Skill 3200MHz 32GB CL14 | CM V850 G2 | RTX 3070 Phoenix | Lian Li O11 Air mini

Samsung EVO 960 M.2 250GB | Samsung EVO 860 PRO 512GB | 4x Be Quiet! Silent Wings 140mm fans

WD My Cloud 4TB

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747060
Share on other sites

Link to post
Share on other sites

If it's possible you're gonna both stress it at the same time, I wouldn't overcommit the cores ( give out a total that excedes the real host logical cores), because that's where problems with over committing arise - the guest expects a core to be able to go at full speed, but it can't.

KVM does have support for hot-plugging cores, but I don't know if Windows guests support it and you can't hot-unplug them.

I'd say just give 6 vCPUs to your machine and 2 to hers. I'm guessing you're gonna do GPU passthrough, and with a dedicated GPU doing video rendering acceleration for her, she's not gonna need more.

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747145
Share on other sites

Link to post
Share on other sites

46 minutes ago, Ronda said:

If it's possible you're gonna both stress it at the same time, I wouldn't overcommit the cores ( give out a total that excedes the real host logical cores), because that's where problems with over committing arise - the guest expects a core to be able to go at full speed, but it can't.

KVM does have support for hot-plugging cores, but I don't know if Windows guests support it and you can't hot-unplug them.

I'd say just give 6 vCPUs to your machine and 2 to hers. I'm guessing you're gonna do GPU passthrough, and with a dedicated GPU doing video rendering acceleration for her, she's not gonna need more.

6 vCPUs for me and 2 for her would be fine :)

About GPU ... well I would be using GTX 1070, that's for sure.

 

For her, I would probbably just use iGPU from motherboard. Or can I also share GPU power with her?

Intel i7 12700K | Gigabyte Z690 Gaming X DDR4 | Pure Loop 240mm | G.Skill 3200MHz 32GB CL14 | CM V850 G2 | RTX 3070 Phoenix | Lian Li O11 Air mini

Samsung EVO 960 M.2 250GB | Samsung EVO 860 PRO 512GB | 4x Be Quiet! Silent Wings 140mm fans

WD My Cloud 4TB

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747242
Share on other sites

Link to post
Share on other sites

Couple of things, applies not just to unRAID:

  • Hypervisors (virtual hosts) don't distinguish cores vs threads when assigning resources to VMs. You give them vCPUs and the hypervisor will manage the required CPU demand and gives the VM what it needs when it needs it. This is a basic explanation but you don't give a core or thread to a VM specifically, as in you don't give it 2 cores and 1 thread you give it 3 vCPUs and where the vCPUs run is up to the hypervisor.
  • You can override the above behavior and do specific assignments but this is generally advised against as more often than not it isn't required to be done and you'll do a worse job than the hypersior can do balancing the load itself.
  • Over provisioning cores is completely normal for servers, typically between 2:1 to 8:1 or even higher in rare and very specific cases. The majority of games don't use all the CPU power available so it is possible to assign say 8 vCPUs to two VMs on a 4c/8t system, however there are other factors to consider (explanation below).

Hypervisor CPU cycle scheduling:

One of the roles a hypervisor has to do, the most important role, is to managed the CPU resources of the physical system for use by itself and any active virtual machines. Each provisioned and active (powered on) virtual machine has a configured vCPU amount and these need to be scheduled to pCPU threads all at once, the more vCPUs assigned the harder it is to schedule pCPU time for the VM. Even if the VM is very idle and is only doing small background OS tasks if you give the VM 6 vCPUs the hypervisor must give it 6 pCPU threads even if only 1 vCPU is active within the VM, there are no half measures it's all or nothing.

 

There are two main reasons why over provisioning of CPU resources works in server environments: 

  • Most servers are idle the majority of the time and rarely go above 40% CPU
  • Virtual machines only get assigned a fraction of the total CPU resources

These two reasons mean even though you might assign 32 vCPUs in total across all VMs on the host which only has 8 pCPU threads no VM is left starved for CPU time and everything runs nice and smoothly.

 

Where this starts to break down is when you assign too many VMs too many vCPUs or when VMs start to consistently demand full utilization of their vCPUs, 100% guest VM activity. This is why the advice is to only assign the number of vCPUs that is actually required, start with less not more if unknown. By over sizing your VMs you will actually get less performance in the individual VM itself which then also means EVERY other VM on the host will have less performance, don't pee in the pool :P.

 

What does this mean for you? Well you could assign all 8 pCPUs to two VMs and most of the time this would work well, where it wouldn't would be in CPU demanding games or when rendering. You could give 1 VM 8 vCPUs and the other VM 4vCPUs, or 7 vCPU and 4 vCPU, or any combination that you think is right and tested/benchmarked to confirm 

 

In saying this what I would actually recommend is getting used parts and build a cheap secondary system, older generation Intel CPUs are still amazingly good and go for very low prices. You can even get the Xeon equivalent part to the desktop model for less and use it in a standard motherboard and normal RAM. With this you get predictable and stable performance for both users at a reasonable price and when not in use you can shut down the secondary system.

 

Desktop virtualization for home users doesn't generally work all that well due to the low number of CPU threads that can be assigned and usability/compatibility issues that are a real issue. It's not as simple as the videos Linus made makes out and you cannot guarantee stability/compatibility now and in to the future, one small change by Intel/AMD/Nvidia/PCIe/USB could stop unRAID being able to do what you want it to. This could come in the form of any product or technology update meaning for example you couldn't upgraded to the latest GPU as it doesn't work that way anymore, unlikely but never a problem in a dedicated system (without something like AGP to PCIe technology transition).

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747428
Share on other sites

Link to post
Share on other sites

@leadeater

 

Woow mate, that was excelent explanation :)

I did get all the answer from this, but I would just like to clarify some things.

 

In my case I'm using 4c/8t CPU. So unRAID will see that as 8 vCores?

Does that mean that I could asign 1 of those cores for unraid only, so I'm left with 4c/7t power for users (VMs)?

 

I know that it would be much eaier to just build 2nd pc for her, and I could do that for cheap money, but where's the fun in that. Also the idea of having 2 PCs is bothering me about space on the desk. It would look much better to have single PC in the middle, and 2 monitor on each side of it.

 

I'm more interested about doing that because I can and because I like to experiment with PCs a bit :)

 

Once again, great answer up there, I realy appreciate your time for writing it.

 

Intel i7 12700K | Gigabyte Z690 Gaming X DDR4 | Pure Loop 240mm | G.Skill 3200MHz 32GB CL14 | CM V850 G2 | RTX 3070 Phoenix | Lian Li O11 Air mini

Samsung EVO 960 M.2 250GB | Samsung EVO 860 PRO 512GB | 4x Be Quiet! Silent Wings 140mm fans

WD My Cloud 4TB

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747561
Share on other sites

Link to post
Share on other sites

Just now, Simon771 said:

@leadeater

 

Woow mate, that was excelent explanation :)

I did get all the answer from this, but I would just like to clarify some things.

 

In my case I'm using 4c/8t CPU. So unRAID will see that as 8 vCores?

Does that mean that I could asign 1 of those cores for unraid only, so I'm left with 4c/7t power for users (VMs)?

 

I know that it would be much eaier to just build 2nd pc for her, and I could do that for cheap money, but where's the fun in that. Also the idea of having 2 PCs is bothering me about space on the desk. It would look much better to have single PC in the middle, and 2 monitor on each side of it.

 

I'm more interested about doing that because I can and because I like to experiment with PCs a bit :)

 

Once again, great answer up there, I realy appreciate your time for writing it.

 

unRAID will see it as a system with 8 CPU threads (4 cores and 8 threads) that can be used, known as physical CPUs (pCPU). Virtual hosts have pCPUs and VMs have vCPUs, so you have 8 pCPUs.

 

You can assign these any way you like, make sure you benchmark each configuration carefully under many different loads and mixtures across both VMs. What Linus means by leaving a core for unRAID is not picking a thread and leaving it free when he is creating the VMs in his video.

 

I'm not a user of unRAID, I use ESXi and Hyper-V, so I'm not fully versed in all the ins and outs of unRAID but yes you could leave 1 thread for it leaving 7 usable. In the hypervisors I use you don't pick the threads a VM will run on normally, just the number of vCPUs you want it to have but you can edit each VM and configure them to only pick from a subset of pCPUs. I do question whether this is actually necessary and it's not something you do with other hypervisors or KVM which it is based off of, add that to your tests.

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747605
Share on other sites

Link to post
Share on other sites

1 hour ago, leadeater said:

unRAID will see it as a system with 8 CPU threads (4 cores and 8 threads) that can be used, known as physical CPUs (pCPU). Virtual hosts have pCPUs and VMs have vCPUs, so you have 8 pCPUs.

 

You can assign these any way you like, make sure you benchmark each configuration carefully under many different loads and mixtures across both VMs. What Linus means by leaving a core for unRAID is not picking a thread and leaving it free when he is creating the VMs in his video.

 

I'm not a user of unRAID, I use ESXi and Hyper-V, so I'm not fully versed in all the ins and outs of unRAID but yes you could leave 1 thread for it leaving 7 usable. In the hypervisors I use you don't pick the threads a VM will run on normally, just the number of vCPUs you want it to have but you can edit each VM and configure them to only pick from a subset of pCPUs. I do question whether this is actually necessary and it's not something you do with other hypervisors or KVM which it is based off of, add that to your tests.

 

Thanks again for great answer.

I will give it a try and try to play around with settings.

Intel i7 12700K | Gigabyte Z690 Gaming X DDR4 | Pure Loop 240mm | G.Skill 3200MHz 32GB CL14 | CM V850 G2 | RTX 3070 Phoenix | Lian Li O11 Air mini

Samsung EVO 960 M.2 250GB | Samsung EVO 860 PRO 512GB | 4x Be Quiet! Silent Wings 140mm fans

WD My Cloud 4TB

Link to comment
https://linustechtips.com/topic/680073-unraid-dedicated-core/#findComment-8747805
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×