0

I am having intel EX5620 Cpu which has 4 Cores and 8 threads.

 cat /proc/cpuinfo is showing   8 cpus.

From xen's wiki page they are saying its better to assign each vm to cpu core for better performance.

So In this case does that mean i can run only 3 vms,if i assign one core to dom0 and rest 3 to each vms.

  OR

can i consider thread as core and thus run 7 vms each with cpu pinned to these threads and one for dom0.

Is there a way to assign vms cpu to thread rather than cores.Will that make any difference?

Kevin Parker
  • 757
  • 1
  • 13
  • 29
  • 1
    Can you link to where in the wiki it says that? Because common sense says that should only make things worse. (Giving the scheduler fewer choices generally causes it to make worse scheduling decisions. Schedulers will already do that unless they have a good reason not to, and if there's a good reason not to do that, why would you want it?) – David Schwartz Oct 24 '12 at 16:10
  • @DavidSchwartz when scheduling what if a cpu may be busy with processing some other requests from a vm,in that case scheduler need to find another cpu which is not being used currently.This can cause performance degradation.If we assign each vm to a physical core then no other vm is going to pin that cpu as it has its own cpu to pin. http://wiki.xen.org/wiki/Xen_Best_Practices – Kevin Parker Oct 24 '12 at 16:16
  • 1
    While that's completely true, that's certainly less performance degradation than would result from the core being idle rather than doing useful work! So yes, you can eliminate that performance degradation, but only by creating an even greater performance degradation. The scheduler completely understands this and would only make that core busy if it had useful work for that core to do and no better place to do it. – David Schwartz Oct 24 '12 at 16:25
  • In case of xen scheduling it utilizes concept of under,over.If cpu of vm is taking actual cpu too much its considered over and vms cpu that is not utilizing actual cpu then its considered under.And scheduler gives more actual cpu to the vms cpu that is referenced under.So cant we reduce this if use dedicated cpu for each vm's cpu. – Kevin Parker Oct 24 '12 at 16:48
  • Could you please tell whether CPU threads can be considered like that of cores? Or is it just two hands on CPU core for making processing faster. – Kevin Parker Oct 24 '12 at 16:50
  • Why would you want to reduce that? Do you think the designers of xen were stupid and deliberately built a scheduler with a broken mechanism that you now need to go out of your way to sabotage? Surely they designed the scheduler to do that because that makes sense. Right? (Is your last comment about hyper-threading? It's hard to tell.) – David Schwartz Oct 24 '12 at 16:52
  • If u think that assigning vm to actual cpu core can reduce performance.Then why should they include that in xen best practices. – Kevin Parker Oct 24 '12 at 16:56
  • yes I was mentioning about Hyper threading. – Kevin Parker Oct 24 '12 at 16:57
  • 2
    I've read that page and don't see where it says you should do that. All I see is: "**If** you're running IO intensive guests or workloads in the VMs it **might** be a good idea to dedicate (pin) a CPU core *only for dom0* use." (Hyperthreading allows one core to act much like two slower cores. However, the scheduler is smart enough not to run two threads in the physical core unless it makes sense to do so.) – David Schwartz Oct 24 '12 at 16:57
  • http://searchservervirtualization.techtarget.com/tip/Memory-and-CPU-allocation-in-Xen-environments-Optimizing-performance under Managing CPUs – Kevin Parker Oct 24 '12 at 17:06
  • 2
    That requires registration and consent to receive emails. But the basic idea, that xen's scheduler is broken by default and requires you to do something to fix it, is just nonsense. Leave it alone. You can't make it work better by giving it fewer options. It knows how to pick the best options based on dynamic demand. All you'll wind up doing is force cores to be idle when they could be doing useful work just because it's the "wrong" work. – David Schwartz Oct 24 '12 at 17:56

1 Answers1

4

You have bad information. Citrix provides a equation to answer your underlying question about CPU assignments.

XenServer 5.0 Update 3 Admin Guide (p. 140). http://support.citrix.com/article/CTX120713 : Provision just enough Virtual CPUs (VCPUs) for each VM's workload.

Don't give a VM more VCPUs than it needs to do its work. If the server in a VM only needs around 300 MHz, it only needs 1 VCPU. Only give it one. If it regularly has 3000MHz worth of work on your 2.5GHz quad-core box, give it two VCPUs; but don't give it three or four. The number of VCPUs a VM has should reflect the amount of work it has to do. If your VM has 2 VCPUs, it should have more work than 1 physical core can do in a timely manner. If it has 4 VCPUs, it should have more work than 3 physical cores can do in a timely manner.

As a formal application of these principles for workloads that require multi-VCPU virtual machines,
allocate VCPUs to maintain this constraint: (V - N) <= (P - 1), where:
V = Total VCPUs across all VMs
N = Number of running VMs
P = Number of Physical CPU cores
benathon
  • 472
  • 2
  • 12
  • thanx for your explanation,but could u tell me how can i determine current actively used CPU in Clock cycles. – Kevin Parker Feb 22 '13 at 04:24
  • The article doesn't say. But I would assume this is pretty easy to calculate: Give the VM a single CPU, boot it, and start it doing work. If the cpu graph stays around 50% then you just multiply the MHZ of a single core on your host machine, by 0.5 and that's how many MHZ work you require. – benathon Feb 22 '13 at 05:24
  • Does this mean a vCPU is like a physical core? (i.e. not a hyperthreaded core) – dashesy Feb 07 '17 at 01:08