5

Yes, funny question.

Given: A host for Hyper-V virtual machines. A HPC type Cluster.

THere are a number of virtual machines on it. They do not use up the CPU most of the time. We also run a HPC style Cluster in house - agents pull Jobs and process them.

There is a talk to install the Agent on our Hyper-V machines. AT the Moment that would give us a significant Performance boost - it will take summer until we really ramp up the Hardware for the calculation Cluster.

The Agents are running all calcualtions in low priority threads. For normal Computers that means that the Agent basically maxes up the CPU usage but does not really interfere with the Computer Operation per se - I even can watch a DVD while the Agent is running.

Now, how is that with Hyper-V? What "thred priority" does the Hyper-V core give the virtual CPU's? Does the root Partition have a higher priorities than the virtual machines? I do not want the agents to interfere with the running virtual machines.

TomTom
  • 51,649
  • 7
  • 54
  • 136

2 Answers2

5

The Hyper-V Parent Partition, or Management OS, is special within the hypervisor. If its virtual processors are runnable, they get a large boost in priority over guest VMs. This is because, in a supported Hyper-V configuration, the only thing the management OS does (statistically speaking) is I/O on behalf of guest VMs. If you install anything else in the management OS, then you're going to preempt work on behalf of guest VMs.

I assume that this has already occurred to you, but you could do this the supported way. Create a VM that is essentially the same size as the physical machine. Give it very low CPU and memory weights and turn on Dynamic Memory so that, when idle, it doesn't use much memory. Run your compute task in that VM. Hyper-V will then prefer doing work for any other guest than that one, but use idle cycles on behalf of your computational task.

Jake Oshins
  • 5,146
  • 18
  • 15
  • Thanks. I thought so - alhthough I can see the parent doing something besides pure basic IO (backup, network firewall etc.) I had this idea it has priority because it slowing down would be - ah - systemic problematic. Do you have any reference to that? – TomTom Jan 02 '13 at 18:57
  • I don't have a reference. But if there were one, it would be created by coming to me. I'm the software architect for Hyper-V. – Jake Oshins Jan 02 '13 at 19:00
  • @JakeOshins I was going to suggest almost the same, but I was under the impression that if a VM is configured for x processors, it actually requires x processors to be available simultaneously to run. Therefore my suggestion was going to be to make a couple of low priority VM's but with single processors. This would increase the likelihood of the VM running while also not stalling out other VM's while they wait a a processor to become available. Thoughts? – longneck Jan 02 '13 at 19:05
  • @longneck Yes, that was a VmWare problem way way back and never a Hyper-V problem. It really kicked scalability. They fixed it fast. Now every virtual processor is individually scheduled. – TomTom Jan 02 '13 at 19:11
  • Some hypervisors require that you need the same number of physical processors available as there are virtual processors in the VM. Hyper-V does not. There's a tradeoff here. The VM will only run well if it is paravirtualized in a way that will allow the guest OS to schedule its virtual processors well on top of that hypervisor. This is true for Windows on top of Hyper-V. – Jake Oshins Jan 02 '13 at 19:11
  • @JakeOshins Ok, - ah - seen it. So, unless you have delusions about features you really wanted to put into Hyper-V but they never got done and you just dont remember that, you definitely ARE the authority on that ;) THANKS ;) Will go the way with separate vm's just running the calculation agent. Let's see how well your baby handles full CPU load ;) – TomTom Jan 02 '13 at 19:13
  • I definitely have occasional delusions. Give us an update on how it worked. – Jake Oshins Jan 02 '13 at 19:15
  • @Jake I opened another question you may find interesting - deals with differntial discs parent paths getting modified when it goes through a junction ;( – TomTom Jan 02 '13 at 20:02
  • @JakeOshins No offense, but given your unique position, your answer should be higher quality. You're "the" software architect for Hyper-V, yet you still have no numbers to offer, and your answer doesn't give any unique insight that my answer didn't already cover. The numbers is the only thing I'm missing. I would be very interested in seeing them. – Ryan Ries Jan 02 '13 at 20:10
  • @JakeOshins Again, I'm really not trying to sound like an ass, I'm just *very* interested in as much technical detail as I can get. And well, since you're here... ;) – Ryan Ries Jan 02 '13 at 20:23
4

First off, I'll just get this out of the way: It is not recommended to run any additional workloads on the parent partition (host OS) of Hyper-V. Its sole purpose in life is to provide management and control functionality to the other guest VMs on the system and to give the administrator a view into the other guest VMs on the system. That said, you can certainly do it and it might work great for you. But the official Microsoft stance is avoid running any additional workloads on your parent partition. Now that that's out of the way:

Happy fun ASCII architecture diagram:

| Parent | Child | Child | Child |
----------------------------------
            Hypervisor
----------------------------------
         Physical Hardware

The parent partition, which is the OS that you boot into and from which you create and control all the other child VMs, is itself really just another logical partition at the same level as the child partitions. All these partitions run in parallel. The only difference is that the root partition is given special privileges and responsibilities by the hypervisor. There are CPU weights and reserves and limits that you can assign to the child virtual machines through the Hyper-V Management console, but it is unclear to me if or how these would map to what we know of as thread priorities in the hypervisor.

On your root partition (or management OS or host OS,) you will see a vmms.exe and 1 instance of vmwp.exe for each virtual machine. The VM Management Service (vmms.exe) is responsible for providing the WMI interface to the hypervisor so that you can manage VMs from an MMC. It also creates a new instance of vmwp.exe when you create a new VM on the system. The VM Worker Process (vmwp.exe) performs virtualization work that a typical monolithic hypervisor would perform, like managing the state of the virtual machine.

On a system with child partitions performing lots of I/O or privileged operations, you would expect most of the CPU usage to be visible in the parent partition: you can identify them by the name Vmwp.exe (one for each child partition). The worker process also includes components responsible for remote management of the virtualization stack... -- Russinovich et al, Windows Internals 6th ed.

But unfortunately, vmwp.exe is not the whole story in terms of what all is going on inside a VM, and if you're thinking about manipulating the priority of those processes from the management OS, you'd probably be in uncharted, possibly unsupportable territory. There are also hypercalls and enlightened calls, etc., that might not be charged against a vmwp.exe process but could still be considered part of the overall workload of a virtual machine.

Apart from critical Hyper-V components that might be present in the root partition and not in the child partitions, that might preempt the execution of other child VM code, I would assume that all partitions are equal to the hypervisor in terms of thread scheduling.

Unfortunately, Microsoft doesn't publish many deeply technical articles to answer these questions. If it weren't for Russinovich and his friends, we wouldn't even have Windows Internals. There's a brief section in there on Hyper-V, which I consulted in writing this post, but even it is not much more in-depth than this post.

Ryan Ries
  • 55,481
  • 10
  • 142
  • 199
  • Hm, so can i assume that the Hypervisor has no idea about the threads of the different vm's. That leaves the good question - if I have 30 vm's all totally busy, what priority does the Parent VM get? I can not really set priority there, or limits. – TomTom Jan 01 '13 at 19:38
  • I agree about the "dont run stuff there" thing. I consider it, but - well - we plan to try it out ;) If anything, I put that onto a separate VM and give it a low priority. – TomTom Jan 01 '13 at 19:39
  • I would instead phrase that as the hypervisor allows the virtual machines to use their own thread schedulers inside the guest OS. The hypervisor implements its own thread scheduler, but most of the threads to be scheduled by the hypervisor can be mapped to the vCPUs assigned to various virtual machines. Given the amount of Hyper-V components that live within the root partition, upon which all the other guest OSes depend, it would not make sense to *not* give the parent partition special priority over the other guests, though I'm afraid I can't give you exact numbers. – Ryan Ries Jan 02 '13 at 03:21
  • Time for a test then, i think. The Agent install is without Problems, so I will try it. Funny. I may end up having to install a separate VM just for running that stuff ;( – TomTom Jan 02 '13 at 05:34