My Hyper-V Best Practices (win 2008-2012)
I've been using Hyper-V since 1.0 in production (and Virtual Server 2005 before it), and have my own personal list of "things to do and not do", applicable to all three versions so far. These are highly opinionated guidelines of mine, but they've worked great and small and large shops.
Guidelines
- NIC's plural: They need at least 2 NIC's plugged into 1GB switch, preferably all 4 NIC's. Smoke 'em if ya got 'em.
- Friends Don't Let Friends Share NIC's: The default Virtual Switch will take the first NIC and share it between the host and guests. The preferred way is to go in and set up the Virtual Switch so that no NIC's are shared (unchecked the "shared with host" box), and the first NIC is just for the host (not used in a Virtual Switch at all). The end result is the host gets a dedicated 1GB NIC, and the guests can use the others. Now in Server 2012, we can team the other NIC's and tell the Virtual Switch to use the team as if it was just one NIC. Here's details on NIC teaming for Hyper-V. It's awesome sauce.
- Friendly Names: With each host having one Virtual Switch, they should be named the same so it's easier to move VM's between them. The Switch name is used to match up VM's to the network when doing import/export.
- Friendly Names, For Real: With so many physical NIC's, it's easier for troubleshooting later if you go into the Network Connections on the host server and rename the NIC's to something like "Host NIC" and "Guest NIC 1", etc.
- There is an I in Teaming: When setting up NIC Teaming in Server 2012, choose options: Switch Independent, Hyper-V Port. This is good when you don't have a single VM that needs more then 1GB and you don't have switches that can be configured for teaming. It basically puts each VM on one of the three physical ports, but if one fails, it will fall back to one of the others. This is a great combo of "zero config" and good performance when using a Hyper-V host. Manual physical switch config to achieve true aggregation is still the best way to go.
- SR-IOV Not So Fast: When setting up a Virtual Switch on new hardware, you may be tempted to click the SR-IOV. It's the new hotness and allows a VM to talk directly to the physical NIC to save nano-seconds. This sounds awesome, but really is only needed if you have something like a high end SQL server that needs every ounce of the NIC, or a voice server where every nanosecond counts. SR-IOV requires the guest be Server 2012, and also manually enabled in guest with PowerShell. It requires very new hardware, and doesn't work with Teamed NIC's in the host… so we're going to leave it off most of the time.
- Mo Disk Means Mo Fun: Run one big RAID6 set on a standard 2U dual processor host. This is definitely not best practice, as you'll read a lot about doing RAID10 for improved I/O, but I find for the average small IT shop that the I/O requirements just aren't there to justify loosing 1/2 of their storage. If you're buying SAS drives (10k RPM and up), then I would do RAID6 *including host partition disks. Yes you read that right. If you look at the I/O of the host disks in the typical RAID1/RAID5 split server, the I/O of the host (just running Hyper-V service) is wasted, sitting near idle. Better to add that I/O to the RAID6 pool for all workloads to share. You can then make your smaller system partition, and put the rest to a Hyper-V disk storage partition. Whew.
- Integrate and Celebrate: Since Server 2008, Windows Server has come with Integration Services built-in. But, if you're running down-level versions of Windows on a Hyper-V host, that you need to upgrade/install the Integration Services to match the host version. So if the host is 2012, then every non-2012 VM on it need their Integration Services.
VM Preferred Settings and Limits
Remember some steps and numbers when setting up new Windows virtual machines in your sexy new Hyper-V host:
- CPU: In Hyper-V 2008 and 2008 R2, you can only give a max of 4 CPU's. Starting in Hyper-V 2012, you can give up to 64, but there's still some supportability limits:
- Server 2003 with SP2 = 2
- Server 2008 with SP2 = 8
- Server 2008 R2 and up = 64
- CPU part deux: Don't be afraid to give more CPU's then you think it needs. You should not use the number of CPU's as a way to control resource utilization. A new 2U server today will typically have 12-16 hyperthreaded cores... so limited your VM's to 2 or 4 is silly. Give boxes 8, or give your SQL/Exchange servers 16, or 24... Then use the built-in CPU priority to control which VM's get a priority on CPU cycles.
- RAM: Dynamic RAM in Server 2008 R2 SP1 and newer is so fantastic that you should enable it for everything except Exchange and SQL servers. Minimum RAM in most scenarios should be 256MB for Server 2003 and 512MB for Server 2008 and newer. Again, don't use the Max RAM to control the distribution of resources, but rather use the RAM priority to do that. Make the Max what you could imagine the server using at it's highest, then add a little more :). I just leave it at the default for most cases.
Update: great list of best practices (very detailed and technical) from MS.
Good Luck!