how can I share CPU between two KVM VPS on a dedicated server?

assume that we have 8-core CPU on a dedicated server

to get maximum performance for two VPS, should I assign 8 cores to each one of them? or just assign 4 core to each VM?


You need to understand the needs of each VM and the threading limitations of the code you have, not every OS and application can make use of all the cores you can throw at it, very often there's zero benefit of expanding past a certain number of cores. The ideal scenario is that you allocate each VM what it needs, not less and ideally not more as that can actually slow down your system in some circumstances.

  • Thanks, I assigned 4 cores two each VM, but I got CPU overload notify from one VM (Cpanel). so I was wondering if I could assign maximum cores to each VM, I'd appreciate your advices. – Zim3r Sep 11 '12 at 9:15
  • Why don't you try adding cores one at a time rather than just jump right in, at least that way you will know if there is a 'right size' for your application. – Chopper3 Sep 11 '12 at 9:19

Assign as many vCPUs as you wish to any virtual guest, up to the number of physical CPU cores (or hyperthreads).

You can overcommit CPU by assigning more vCPUs among your running virtual machines than exist in the server, subject to the limit that no single virtual guest may have more vCPUs than physical CPU cores.

Keep in mind that if you have CPU intensive tasks, that overcommitting CPU won't buy you anything and may slow down the rest of your guests.

  • Thanks, In virt-manager there is no "vCPU" it just "CPU" and it's equal to number of cores. I have two VPS with almost same resource usage. and I was wondering if I could assign maximum cores to each VM. so it does slow down if I assign 8 cores to each VM ? – Zim3r Sep 11 '12 at 9:12
  • 1
    In virt-manager it says "Logical CPUs", which is the same thing. Virtual CPU cores assigned to your guests. If you assign all 8 cores to each guest, then they will contend for the available CPU time. But if you assign 4 cores to each guest, then you will have 8 cores used and contention will be minimal. – Michael Hampton Sep 11 '12 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.