Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a server that is running Windows 2008 64 bit Hyper-V, with 8 gigs of RAM and Intel Xeon X3440 @ 2.53 Ghz, which gives me 8 logical cores in the performance monitor on the host system.

I have set up three Virtual Machines, all running Windows 2008 32 bit.

  1. Build server, running Team City
  2. Staging server
  3. SQL Server, running SQL Server 2005

These three machines are running very sluggishly, they are at 100% cpu even though the host system is barely using any cpu at all, typically below 10% total.

Could anyone please give some tips as to the best setup for CPU allocating? Should I have set each server to have two cores, or should I increase this number above the total number of cores on the host?

What is a good number to set on the Virtual Machine Reserve and Virtual Machine Limit?

Is 8 gigs of physical RAM insufficient for 3 VM's?

Thanks for reading. :)

share|improve this question
    
@Bjørn: I put this on your other post as well - make sure you are looking at Disk IO in addition to CPU and Memory. –  MattB Apr 16 '10 at 13:57

5 Answers 5

up vote 2 down vote accepted

Bjørn, you're worried about something that isn't an issue. In your case, you have a hypervisor and four virtual machines. One of those virtual machines (the management OS) came with the hypervisor. You then installed three virtual machines.

Ask yourself whether you'd like to see the management OS using CPU time. Ideally, you want it to leave as much CPU time as it possibly can to the three VMs that you set up.

This is exactly what Hyper-V does, assuming that you have installed the "VM Integration Components" in all your VMs. These components make I/O much more efficient by installing drivers that are meant for VMs. Then, unless your VMs are particularly I/O-heavy, your management OS will just sit there waiting for you to interact with it, attempting to use as few resources as possible. This is a good thing.

If you want to see the actual CPU metrics from the hypervisor, not the management OS, use Performance Monitor in the management OS and look for the Hyper-V counters. These will tell you about physical CPU usage.

Doug Luxem (who seems to know a lot about this) answered this well on another thread today. So I'll just steal his text:

First, you have to remember that in Hyper-V that the "host" is called a parent partition and it really just like a virtualized guest with special permissions and roles. Just like any other child/guest, when you open up Task Manager, you can not see the CPU usage of the other children on the server.

Ben Armstrong has a good explanation of this here: http://blogs.msdn.com/virtual_pc_guy/archive/2008/02/28/hyper-v-virtual-machine-cpu-usage-and-task-manager.aspx

Lastly, look at RAM usage in your VMs. Look at disk queue length. These will tell you if you need more RAM. It sounds, though, like your VMs just need more total CPU than the host has to give.

share|improve this answer
    
This looks like the actual answer I was looking for, but I will take time going through all activity in the thread tonight before i mark it. My big misunderstanding was obviously that the host system is not actually the OS on the actual server, rather being just another VM. Thanks for your time everyone! –  Bjørn Apr 17 '10 at 10:45

I cannot remember 100% how this worked, but look into the following

I believe the Hyper-V OS (host OS if you will) is just a shell and doesn't display these counters properly, not in perfmon anyway. It could also be that it displays only what the host OS itself is using, and not the VMs.

It's been a while since I worked with Hyper-V but I think this was the baseline of what you're seeing.

Good luck

share|improve this answer
    
Agreed, never read CPU utilisation data from INSIDE a VM, whereas memory utilisation is generally much more accurate. –  Chopper3 Apr 16 '10 at 9:20
    
First of all, thanks for your time! But aren't you saying two different things, in that HannesFostie says that I cannot read CPU usage in the Host system, and Chopper3 says that I cannot read CPU usage in the VM's? Do you know any way I can accurately read how much CPU is being used at any time, and by which VM? The simple fact is that the host system is very responsive, while the VM's are not responsive at all. –  Bjørn Apr 16 '10 at 10:36
    
Both are true as far as I can remember: reading stuff like CPU inside a host is generally a bad idea, but other than that I remember perfmon counters with hyper-v being inprecise and unreliable and I'm pretty sure this applies to your situation. –  HannesFostie Apr 16 '10 at 11:05

This is a short and good post about Hyper-V and CPU usage. I'll leave the explaining to the article.

Furthermore, the best practice for getting optimal performance out of VMs is to make sure you have a 1:1 mapping of logical to physical cores. So if you have 3 VMs and 8 cores, you could do 2 logical cpu's on all VMs, leaving two for the hypervisor/host.

It is generally a bad idea to increase the logical number above the physical number.

Another way to speed up performance is to set up static VHDs or pass through disks.

8 GB of RAM should be more than enough for three of most VMs, but it all depends on the applications running and how much they'd like to work optimally. Check documentation on each.

Hope this helps.

share|improve this answer
    
It is very common for companies to virtualize systems running on obsolete hardware (read: very low CPU usage) before tackling more challenging, CPU-intensive servers for which virtualization offers fewer direct benefits. A Hyper-V host with numerous non-CPU-intensive guest machines will do fine with more logical cores than physical cores. There is no compelling reason to reserve an entire physical core for a single-CPU VM if the guest's CPU usage hovers near idle. Too subjective for "generally a bad idea" IMHO. –  Skyhawk Apr 16 '10 at 13:12

Ok, as someone running a lot of VM's ;)

  • Memory is not the issue, pretty obviously. Ou have to watch IO on the host side (i.e. all totaly) AND on the VM side, but if you manage to allocate 100% cpu within a VM - it pretty obviously does not trach the discs and not use the allocated CPU slots. Not saying more memory is not usefull, but like a physical computer - a VM going into virtual memory heavily would not be able to fully utilize all allocated CPU cycles.

  • You say the CPU is at 100%, but the host does barely bulge. How many CPU cores does the HOST have? Iff that is a 4 core, hyper-threading system (exposing 8 cores - sorry, I am totally a AMD guy), a VM using 2 cores at 100% would ONLY show up as - 25% to start on the host. That is already assuming you use the proper way to measur CPU utilization to start with (prpoer Hyper-V counters, or the Hyper-V manager for a short idea). A ONE CORE server on a 8 CORE host CAN - physically - only ever use up 12.5% of the available CPU power to start with. If that makes the VM sluggish from within (which could be - depends on VM internal CPU Prioritization) then - this is like a normal computer being overloaded, but the host barely sees it.

As such, 3 VM's and a 8 core CPU make zero sense to use 1 virtual CPU per host. You basically leave most of your processor power unavailable for the virtual machines. If you go dual core on every server - assuming the server and processes gain from it - this will give you better uitlization. THat said, you could possibl go higher - depending how load is distributed (does SQ LServer do a lot while the other servers are busy?).

Just as example - one of my machines is a 32 gigabyte AMD Opteron system (soon to be 64 gbyte). I rarely get the CPU fully loaded (with only 4 cores) - simply because albeit I run more than a dozen servers on it, most are not busy at the same time, or light load systems (multiple DNS for example). I have another server where TFS (Ms equivalent to TeamCity) Runs, and if I have some action there - things get nasty. Builds, unit tests, scheduled virtual machine lab tests, database unit tests - all use up tons of CPU power. Depending on how busy that is this CAN requier more CPU power. How buy is mostly a "how many users" thing - 2-3 developers rarely keep the server busy most of the time.

So, even if you allocate multiple cores for for example TeamCity - will you do tings like multiple compiles at the same time, or not? If there is one developer checking in, he simply will never check in in two projects at the same time ;) But give it a try ;)

share|improve this answer

Ok, what I have done so far:

Memory allocated to each server: 2300, 2300 and 2000 megs. This leaves just a little bit free memory on the host and each of the VM's.

4 virtual processors on each server. At any one time, its mostly two servers working, the SQL server either together with the build server, or with the staging server. So that means that probably most of the time 8 virtual processors will be busy at one time, with the last 4 not doing that much.

Virtual Machine Reserve set to 0 on all VM's. Virtual Machine Limit set to 100% on all VM's.

In a desperate attempt to get the CPU's busy I have set the VM's worker processes to Realtime Priority on the Host.

The CPU readings are still very low on the host, but now they are not so intense on the VM's, and they seem more responsive.

share|improve this answer
    
Increasing the number of virtual cores per server was a good idea. Adding more RAM to the host certainly wouldn't hurt, particularly if the SQL server needs more for read performance. However: "I have set the VM's worker processes to Realtime Priority on the Host" seems very likely to have unintended consequences down the road. –  Skyhawk Apr 16 '10 at 13:00
1  
As a matter of fact - ONE consequence is that the server may FEEL sluggish, as the UI has not enough CPU left.... Realtime says "do that BEFORE ALL ELSE" - and that includes disc IO, user interface etc. BAD idea in 99% of the cases. REALLY BAD. And I write "real time" data collector programs for financial data ;) –  TomTom Apr 16 '10 at 13:27
1  
Do not change the VM process priority, and you should not need to change the reserve or CPU limit. Task Manager in the parent partition does NOT give you an accurate measure of physical CPU usage so stop looking at it. –  Doug Luxem Apr 16 '10 at 13:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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