Learning Hyper-V - Vinicius R. Apolinario - E-Book

Learning Hyper-V E-Book

Vinicius R. Apolinario

0,0
44,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

This book focuses on readers starting their journey with Hyper-V, and assumes they have minimal or no knowledge of virtualization.



Das E-Book Learning Hyper-V wird angeboten von Packt Publishing und wurde mit folgenden Begriffen kategorisiert:

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 405

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Learning Hyper-V
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Instant updates on new Packt books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Getting Started with Hyper-V Architecture and Components
Hypervisor architecture
Type 1 and Type 2 Hypervisors
Microkernel and Monolithic Type 1 Hypervisors
Hyper-V requirements and processor features
Memory configuration
Non-Uniform Memory Access (NUMA) architecture
Dynamic memory
Dynamic memory configuration
Memory buffer
Memory weight
Smart Paging
Summary
2. Deploying Hyper-V Hosts
Considerations before installing a Hyper-V Host
Windows Server with a GUI
Enabling the Hyper-V role
Hyper-V Manager
Windows Server without a GUI
Windows Server Core
Windows Server Minimal Server Interface (MiniShell)
Microsoft Hyper-V Server
Remote Server Administration Tools (RSAT) and Hyper-V Manager for Windows
Hyper-V for Windows
Microsoft Best Practices Analyzer (BPA)
Antivirus – to be or not to be?
Hyper-V Hosts and VM Limits
Summary
3. Licensing a Virtualization Environment with Hyper-V
Licensing a virtual environment prior to Windows Server 2012
Standard and Enterprise Editions of Windows Server 2008 and 2008 R2
Datacenter Edition of Windows Server 2008 and 2008 R2
Licensing a virtual environment with Windows Server 2012 and 2012 R2
Virtualizing with Standard or Datacenter Editions
Specific scenarios with Standard Edition
Virtualization host licensing and its impacts
Licensing Windows Server VMs with other Hypervisors
Host licensing with Hyper-V Replica
Hyper-V licensing with Linux VMs
Windows Client licensing on Hyper-V
Windows PCs and VDI
Company-owned Windows RT tablets
User devices inside or outside the company network
Non-Microsoft smartphone and tablet licensing for VDI
VDI licensing, RDS, and virtualization host licensing
VDI scenarios and licensing options
Summary
4. Managing Networking
Hyper-V Switch basics
Creating a Hyper-V Virtual Switch
Creating a Hyper-V Virtual Switch using PowerShell
Connecting a VM to a Virtual Switch
Advanced configuration for Hyper-V networking
Converged Networking on Hyper-V
Creating NIC Teaming
Creating a virtual NIC on the host
Bandwidth Management on Hyper-V
VM network features
Network Adapter features
Hardware Acceleration
Virtual Machine Queue
IPsec task offloading
SR-IOV
Advanced Features
MAC address
DHCP guard and Router guard
Protected network
Port mirroring
NIC Teaming
Other network implications
Policy-based QoS
Data Center Bridging
Remote Direct Memory Access
Jumbo Frame
Windows Firewall
Hyper-V Extensible Switch
Summary
5. Managing Storage
Host storage
Hard Disk Drive (HDD) or Solid State Drive (SSD)?
RAID recommendations for virtualization
Local storage or Local disks
Direct Attached Storage (DAS)
Storage Area Network (SAN)
Fibre Channel (FC)
iSCSI
Network Attached Storage (NAS)
Server Message Block 3 (SMB3)
Windows Server as a storage option
Windows Storage Spaces
Installing a Windows Server iSCSI Target Server
Installing a Windows Server SMB3 Server
Clustered iSCSI Target and SMB3
Other host storage implications
Virtual SAN Manager and virtual Fibre Channel adapter
4K disk
Multipath IO (MPIO)
VM storage
Physical disk or pass-through disk
Virtual Hard Disk (VHD)
VHD or VHDX?
Creating a virtual disk and associating it with a VM
Online VHDX Resize
Virtual disk Quality of Service (QoS)
Storage Live Migration
Summary
6. Virtual Machines and Virtual Machine Templates
Virtual machine management
Generation 1 and 2 VMs
Creating and modifying a VM
Checkpoints
Virtual machine templates
Sysprepped VMs
Differencing disks
PowerShell Desired State Configuration (DSC)
Summary
7. Implementing High Availability
Microsoft failover cluster and Hyper-V overview
Failover cluster installation and configuration
Quorum and Node Majority
Configuring storage for Hyper-V cluster
Creating a highly available VM
Managing a highly available VM
Setting Startup Priority
Live migrating a VM
Configuring VM Monitoring
Shared VHDX
Summary
8. Implementing Live Migration and Replica
Share Nothing Live Migration
Configuring the Kerberos authentication for Live Migration
Performance options for Live Migration
Configuring Share Nothing Live Migration with PowerShell
Live migrating a VM
Move the virtual machine
Moving the VM storage
Hyper-V Replica
Configuring Hyper-V Replica
Replicating a VM
Testing Hyper-V Replica
Failing over a VM
Reversing the replication
Extended replication
Summary
9. Virtualizing Active Directory Domain Controllers
Active Directory virtualization concepts
Domain Controller database configuration
Time synchronization and virtual DCs
Virtual DCs and Checkpoints
Virtual DCs and Cluster service
Virtual DC cloning
Granting the source DC the permission to be cloned
Running the Get-ADDCCloningExcludedApplicationList cmdlet
Running the New-ADDCCloneConfigFile cmdlet
Creating the virtual DC clones using the export/import process
Virtual DCs and Hyper-V Replica
Summary
10. Implementing a Virtual Desktop Infrastructure
VDI overview and comparison
VDI characteristics
Getting started with Microsoft VDI
Pooled and Personal VMs
Creating a Pooled VM collection
Creating a Personal VM collection
User Profile Disks
RemoteFX
Recreating the VM template
Summary
11. Protecting Your Virtualization Environment
Windows Server Backup overview
Getting started with Windows Server Backup
Incremental backups
Backing up your host and VMs
Restoring your host and VMs
Import and export VMs
Summary
Index

Learning Hyper-V

Learning Hyper-V

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: May 2015

Production reference: 1260515

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78439-986-3

www.packtpub.com

Credits

Author

Vinícius R. Apolinário

Reviewers

Rafael Bernardes

Leandro Carvalho

Tomas Dabasinskas

David Luu

James Murray-Curtis

Federico Tonelli

Commissioning Editor

Edward Bowkett

Acquisition Editor

Sonali Vernekar

Content Development Editor

Pooja Nair

Technical Editors

Rahul C. Shah

Ankita Thakur

Copy Editors

Sonia Michelle Cheema

Stephen Copestake

Sonia Mathur

Vikrant Phadke

Project Coordinator

Suzanne Coutinho

Proofreaders

Stephen Copestake

Safis Editing

Indexer

Mariammal Chettiyar

Graphics

Disha Haria

Production Coordinator

Arvindkumar Gupta

Cover Work

Arvindkumar Gupta

Foreword

Few other areas of knowledge have had so many technological revolutions as hardware abstraction and virtualization in such a short period.

In this new scenario, Vinícius R. Apolinário showcases the newest advances in the area of virtualization. In his own unmistakable style, he explains complex issues through examples that introduce important concepts in a simple and didactic way.

This book is intended for anyone who wants to learn Hyper-V. If you have basic knowledge of virtualization or a competing technology, such as VMware, it will help, but it is not a requirement. The book begins with a fundamental understanding of each technology and then discusses more advanced topics such as High Availability, replication, Disaster Recovery, storage, networking, templates, and a special chapter that deals with the best practices of using virtualization Domain Controllers. If you are an architect, a consultant, a network administrator, or really anyone who just wants a better understanding of Hyper-V, this book is for you.

Vinícius R. Apolinário knows a lot about his subject, and this book is a step forward in the knowledge of this vast field. He endeavored to study it, and he has become an expert since then. I witnessed the beginning of his career and his growth as a network administrator for a small company when I interviewed him for a job while he was still attending the university. He was hired as a Microsoft technical evangelist, sharing his knowledge with thousands of professionals through blogs, webcasts, and live events.

Considering all of this, this book is indispensable to professionals who wish to not only monitor the most important advances of Hyper-V technology, but also to acquire a solid background in an area as dynamic as computer virtualization.

Happy is the person who transfers what you know and learns what you teach.

Enjoy reading!

Gilson Banin

Microsoft Premier Field Engineer

About the Author

Vinícius R. Apolinário is a professional with more than 13 years of experience in information technology. He has worked with Microsoft and in other industries, managing servers and environments of small, medium, and large companies. With a strong background in managing servers for directory services and client infrastructure, he has focused on virtualization and data center management in recent years.

Vinícius is a Microsoft Certified Trainer and system engineer on Windows Server 2012 and Private Cloud. Besides this, he holds a cloud computing certification from EXIN and teaches this technology. He also holds a certification of Extension Course in Product Marketing Manager by Fundação Getúlio Vargas (FGV). His last achievement was becoming a VMware Certified Associate and a VMware Certified Professional for data center virtualization.

Currently, Vinícius works for Microsoft in Brazil as a technical evangelist, presenting new technologies on Windows Server, Hyper-V, System Center, and Microsoft Azure to customers. Prior to this book, he reviewed Hyper-V Cookbook and Hyper-V Cluster Design.

I would like to start by thanking my wife. As always, her support and understanding were essential in helping me accomplish this. Thank you, little girl, for always being by my side and for all the love.

I thank my manager, Danilo Bordini, for supporting this project, for all the tasks I have in my current role, and for supporting the rest of my career. Thanks to my coworker and friend Fabio Hara for all the knowledge shared over the time we have worked together.

I would also like to thank my great friend Gilson Banin, who has always helped me in my career and has always been an inspiring professional for me and many others.

Additional thanks to Rafael Bernardes and Leandro Carvalho, the reviewers of this book and excellent professionals, for accepting the challenge and all the feedback!

About the Reviewers

Rafael Bernardes is the founder of CooperaTI, one of the most recognized IT portals in Brazil. He is well-known personality and holds recognitions by Microsoft with the MVP, MiVP, and TechNet IT Hero titles.

Rafael also holds an MCSE (Microsoft Certified Solutions Expert) certification in Private Cloud as well as the most recent cloud and virtualization certifications.

First, I must thank my wife, Renata. Without her support, I wouldn't have been the professional I am today. I would like to thank Vinícius R. Apolinário for the excellent challenge of contributing to the technical review of this book. The book is awesome and goes straight to the point. I recommend it to everybody.

Leandro Carvalho is a well-known virtualization specialist, who writes and presents sessions on virtualization and cloud computing. He works as a system engineer on Microsoft solutions, such as Windows Server, Hyper-V, App-V, VDI, System Center, Exchange, Lync Server, SharePoint, Project Server, security, and client systems. He also helps the community frequently with articles, forums, videos, and lectures about his passion—Microsoft virtualization. Leandro has the certifications of Certified Ethical Hacker, MCP, MCSA+M+S, MCSE+S, MCTS, MCITP, MCT, and MVP. In 2009, he received the Trainer of the Year award from MCT Awards, Latin America. He has won the Microsoft MVP award as a virtualization specialist every year since 2010. He has also worked on Windows Server 2012 Hyper-V Cookbook.

Leandro can be contacted at http://leandroesc.wordpress.com, and his Twitter handle is @LeandroEduardo.

I would like to thank my wife, Juliana, and my son, Eduardo, for their ongoing support, understanding, and encouragement. You are the source of my inspiration and happiness.

I also wish to thank Vinícius R. Apolinário for the invitation to be the reviewer of this book. It was a real pleasure because in 2012, he was the reviewer of my book. Here we are now—history repeating itself—with me as the reviewer of your book, so thanks again!

Tomas Dabasinskas started his career in the IT field during his days at the university, where he was studying software engineering. He started working as a developer, but a few years later, he moved into the IT Pro field. For a few years, Tomas worked on implementing and deploying a number of different solutions based on Microsoft technologies, including SharePoint, Exchange, and Hyper-V. Now, he is working as a lead for a Windows support team in a large enterprise organization. He also has to deal with virtualization technologies (both VMware ESXi and Microsoft Hyper-V).

David Luu is a quality assurance engineer, software developer, and technical writer. His professional experience and interests include working with technologies such as virtualization, networking, Microsoft Windows, .NET, cloud computing, and more. He primarily tests software products and services, occasionally workin on software development, documentation review, and technical writing/editing.

David also contributes to open source software and has released a .NET library to facilitate the management of Hyper-V virtual machines programmatically. It is available at http://code.google.com/p/robotframework-hypervlibrary/.

James Murray-Curtis has a BSc (Hons) degree in computing and information systems from London Metropolitan University. Through the course of his continual professional development, he has acquired numerous Cisco and Microsoft certifications. He has worked in the IT field for the last 10 years and has been involved in multiple projects for large organizations as a systems engineer. James is currently employed as an IP network engineer for a leading on-demand mobile virtual network enabler (MVNE). When he is not supporting, fixing, and maintaining core network infrastructure, he works as an MCT for a local training academy. This is of great benefit to his students, as he uses not only his academic knowledge but also his practical experience in high-availability systems in production environments and core networks. James has experience in teaching Windows Server, Exchange Server, and virtualization.

I would like to thank my fiancée, Trisha, for the continual support and love she has had for me throughout my career development and studies.

Federico Tonelli was born on June 3, 1985. He lives in Livorno (Leghorn in English), Tuscany, Italy, and he also studied there up to high school. Then, he studied information technology at the University of Pisa and obtained his bachelor's degree in 2009, with a thesis on security of P2P networks through virtual machines. Then, he studied security information at La Spezia, a wing of the University of Pisa, where he obtained his master's degree (110 cum laude) in 2012. After gaining his master's degree, he was a scholarship holder, and his research was about vulnerability analysis in SCADA systems, funded by Enel Engineering and Services. Finally, he got a call for becoming a PhD student and secured the first place, with a score of 99/100.

Federico's main research interests in the computer security field are formal approaches to risk assessment and management of complex ICT infrastructures. He has been involved in risk assessment and management of several systems, and he has worked on industrial control systems with SCADA components. He has authored several papers on ICT security. Federico is currently developing a suite of tools, named Haruspex, to automatize risk assessment and management of any ICT infrastructure.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Instant updates on new Packt books

Get notified! Find out when new books are published by following @PacktEnterprise on Twitter or the Packt Enterprise Facebook page.

Preface

Hyper-V is gaining market share over its competitors, and is already the leader in some markets. With the release of Windows Server 2012, Hyper-V is positioned not only as a low cost alternative, but also as a featured virtualization platform. Therefore, every day, an increasing number of administrators take the first step to acquiring Microsoft virtualization technologies. As a step-by-step guide, this book will take you through a journey that involves learning about the Hyper-V platform from scratch. This will prepare you to become a more versatile Hyper-V admin.

What this book covers

Chapter 1, Getting Started with Hyper-V Architecture and Components, covers the Hyper-V architecture and takes a deep dive into how its basic components, such as the processor and memory, can influence a host's performance and utilization.

Chapter 2, Deploying Hyper-V Hosts, covers multiple Hyper-V deployment options and provides you with the pros and cons of each option.

Chapter 3, Licensing a Virtualization Environment with Hyper-V, provides an overview of licensing a virtualization environment with Hyper-V for Windows Server, Windows Client, and Linux VMs. You will also be given tips and tricks regarding licensing Microsoft virtualization environments.

Chapter 4, Managing Networking, focuses on networking configuration for hosts and Virtual Machines (VMs), allowing you to understand how to configure physical and virtual networks for better performance.

Chapter 5, Managing Storage, covers storage and its influence on a host and VM performance, and presents you with techniques to optimize storage.

Chapter 6, Virtual Machines and Virtual Machine Templates, covers multiple components of a VM and its templates to optimize creation of a VM with Hyper-V.

Chapter 7, Implementing High Availability, provides an overview of Microsoft failover clusters that are used to support Hyper-V with High Availability (HA).

Chapter 8, Implementing Live Migration and Replica, covers how to prepare a virtualization environment for scheduled maintenance and Site Disaster Recovery.

Chapter 9, Virtualizing Active Directory Domain Controllers, covers the best practices used to virtualize Domain Controllers, avoid replication problems, and get around configuration mistakes.

Chapter 10, Implementing a Virtual Desktop Infrastructure, covers the basics involved in Virtual Desktop Infrastructure (VDI) and Remote Desktop Services (RDS), and how Hyper-V can support them.

Chapter 11, Protecting Your Virtualization Environment, gives an overview of the protection used for hosts and VMs in a virtualized environment. The chapter will also provide an overview of other tools that are used for backup and restore.

What you need for this book

This book is based on the Hyper-V and Windows Server technology. If you want to reproduce the labs in this book, you will need a computer (a server, workstation, or laptop) that meets the Hyper-V requirements described in Chapter 1, Getting Started with Hyper-V Architecture and Components, and a Windows Server trial license or a Hyper-V Server to install on the computer you will be using.

Who this book is for

This book focuses on readers starting their journey with Hyper-V, assuming they have minimal or no knowledge of virtualization. You are given your first steps into Microsoft virtualization technology, and you will need to install, configure, and maintain Hyper-V Hosts and VMs to prepare their environments for next-generation technologies.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If you do not wish to restart the server right away, you can remove the -Restart option and run the Restart-Computer later."

Any command-line input or output is written as follows:

Install-WindowsFeature –Name Server-Gui-Mgmt-Infra –Restart

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "From Server Manager, select Hyper-V group, right-click the server you want to manage, and select Hyper-V Manager."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.

Chapter 1. Getting Started with Hyper-V Architecture and Components

Hyper-V has evolved since its release back in 2008. At that time, Hyper-V was released as an update to Windows Server 2008, KB950050 to be more precise (which can be found at https://support2.microsoft.com/kb/950050/en-us). Many of the features available today were not present at that point. If you take a look, you can actually see that virtualization has been one of the areas of major investments by Microsoft, not only with Hyper-V, but also to ensure that all its major products would be able to run perfectly on a virtualization environment. As an example of how Hyper-V has evolved, Microsoft Azure runs entirely on it. In the first release, Hyper-V did not have Live Migration, Storage Live Migration, Replica, Dynamic memory, and many other features. It also had support for only four virtual processors and 64 GB of virtual RAM per Virtual Machine (VM). At first, Hyper-V's only appeal was its price, or the fact that it is not charged at all.

Nowadays, Hyper-V is the leading virtualization solution in many markets and is rapidly gaining market share over its competitors. The reason behind this is actually simple. Hyper-V combines a solution that meets the higher expectations of large enterprises and since it's delivered free, even small companies can benefit from all Hyper-V features. Moreover, Microsoft Hyper-V Server is a totally free virtualization platform with no restrictions, compared to the Hyper-V from Windows Server, and is a perfect scenario for open source users too. Licensing and Utilization options will be explained in detail in Chapter 3, Licensing a Virtualization Environment with Hyper-V, so for now, all you have to keep in mind is that Microsoft delivers all its virtualization technologies at no cost.

However, before we go through all the Hyper-V features that this book will cover, it's important to understand the architecture and components of Hyper-V, so you'll have a better understanding on how all this works and will be able to make better decisions when planning your virtualization environment.

In this chapter, we will cover the following topics:

Hypervisor architectureType 1 and 2 HypervisorsMicrokernel and Monolithic Type 1 HypervisorsHyper-V requirementsProcessor and memory configuration

Looking back in history, Hyper-V is not the first virtualization technology from Microsoft. Actually, virtualization, emulation, and other techniques have been used since the first computer was released. Even mainframes use these techniques. Specifically, virtualization, as we know today, was imagined to solve a common problem, that is, the average utilization of a server is extremely low. Even though some components are used more than others, the total utilization of a server is minimal. That happens because when you plan for a server that will run an application, you have to plan for the higher utilization moment, when an application is stressed. But this utilization peak will occur just a few times during the month. For all other times, your server will be either idle or using 5 to 10 percent of all its capacity. That is the average. Before virtualization, another technique was also used: server consolidation. This technique consists of running multiple applications on the same server. The problem with this option is that you have no isolation between the application environment, and often, you can't combine too many different applications on the same server as they may have totally different requirements. Another problem of the server consolidation is that the utilization peak will create another problem of two concurrent applications on the same server. This technique is hardly used today, as virtualization addresses these issues in a much better way.

Microsoft has played in this field of better hardware utilization since its first operating system. Even Microsoft DOS had some options for doubling RAM. Windows 3.X introduced paging, also known as virtual memory, on later Operating Systems (OS). The game started to change in 2003, when Microsoft bought two products called Virtual PC, which already had released versions for Mac OS and Windows, and Virtual Server, which was in the development phase at that moment, from Connectix. With the acquisition, part of the staff from Connectix came to Microsoft, and, in 2004, Microsoft released Microsoft Virtual Server 2005.

Compared to the first version of Hyper-V, Microsoft Virtual Server is a dinosaur. That's not only because Hyper-V implements new features, but also because there is a major architectural difference between these products. This is the Hypervisor architecture.

Hypervisor architecture

If you've used Microsoft Virtual Server or Virtual PC, and then moved to Hyper-V, I'm almost sure that your first impression was: "Wow, this is much faster than Virtual Server". You are right. And there is a reason why Hyper-V performance is much better than Virtual Server or Virtual PC. It's all about the architecture.

There are two types of Hypervisor architectures. Hypervisor Type 1, like Hyper-V and ESXi from VMware, and Hypervisor Type 2, like Virtual Server, Virtual PC, VMware Workstation, and others. The objective of the Hypervisor is to execute, manage and control the operation of the VM on a given hardware. For that reason, the Hypervisor is also called Virtual Machine Monitor (VMM). The main difference between these Hypervisor types is the way they operate on the host machine and its operating systems. As Hyper-V is a Type 1 Hypervisor, we will cover Type 2 first, so we can detail Type 1 and its benefits later.

Type 1 and Type 2 Hypervisors

Hypervisor Type 2, also known as hosted, is an implementation of the Hypervisor over and above the OS installed on the host machine. With that, the OS will impose some limitations to the Hypervisor to operate, and these limitations are going to reflect on the performance of the VM.

To understand that, let me explain how a process is placed on the processor: the processor has what we call Rings on which the processes are placed, based on prioritization. The main Rings are 0 and 3. Kernel processes are placed on Ring 0 as they are vital to the OS. Application processes are placed on Ring 3, and, as a result, they will have less priority when compared to Ring 0. The issue on Hypervisors Type 2 is that it will be considered an application, and will run on Ring 3. Let's have a look at it:

As you can see from the preceding diagram, the hypervisor has an additional layer to access the hardware. Now, let's compare it with Hypervisor Type 1:

The impact is immediate. As you can see, Hypervisor Type 1 has total control of the underlying hardware. In fact, when you enable Virtualization Assistance (hardware-assisted virtualization) at the server BIOS, you are enabling what we call Ring -1, or Ring decompression, on the processor and the Hypervisor will run on this Ring.

The question you might have is "And what about the host OS?" If you install the Hyper-V role on a Windows Server for the first time, you may note that after installation, the server will restart. But, if you're really paying attention, you will note that the server will actually reboot twice. This behavior is expected, and the reason it will happen is because the OS is not only installing and enabling Hyper-V bits, but also changing its architecture to the Type 1 Hypervisor. In this mode, the host OS will operate in the same way a VM does, on top of the Hypervisor, but on what we call parent partition. The parent partition will play a key role as the boot partition and in supporting the child partitions, or guest OS, where the VMs are running. The main reason for this partition model is the key attribute of a Hypervisor: isolation.

Note

For Microsoft Hyper-V Server you don't have to install the Hyper-V role, as it will be installed when you install the OS, so you won't be able to see the server booting twice.

With isolation, you can ensure that a given VM will never have access to another VM. That means that if you have a compromised VM, with isolation, the VM will never infect another VM or the host OS. The only way a VM can access another VM is through the network, like all other devices in your network. Actually, the same is true for the host OS. This is one of the reasons why you need an antivirus for the host and the VMs, but this will be discussed later.

The major difference between Type 1 and Type 2 now is that kernel processes from both host OS and VM OS will run on Ring 0. Application processes from both host OS and VM OS will run on Ring 3. However, there is one piece left. The question now is: "What about device drivers?"

Microkernel and Monolithic Type 1 Hypervisors

Have you tried to install Hyper-V on a laptop? What about an all-in-one device? A PC? A server? An x64 based tablet? They all worked, right? And they're supposed to work. As Hyper-V is a Microkernel Type 1 Hypervisor, all the device drivers are hosted on the parent partition. A Monolithic Type 1 Hypervisor hosts its drivers on the Hypervisor itself. VMware ESXi works this way. That's why you should never use a standard ESXi media to install an ESXi host. The hardware manufacturer will provide you with an appropriate media with the correct drivers for the specific hardware.

The main advantage of the Monolithic Type 1 Hypervisor is that, as it always has the correct driver installed, you will never have a performance issue due to an incorrect driver. On the other hand, you won't be able to install this on any device.

The Microkernel Type 1 Hypervisor, on the other hand, hosts its drivers on the parent partition. That means that if you installed the host OS on a device, and the drivers are working, the Hypervisor, and in this case Hyper-V, will work just fine.

Note

There are other hardware requirements. These will be discussed later in this chapter.

The other side of this is that if you use a generic driver, or a wrong version of it, you may have performance issues, or even driver malfunction. What you have to keep in mind here is that Microsoft does not certify drivers for Hyper-V. Device drivers are always certified for Windows Server. If the driver is certified for Windows Server, it is also certified for Hyper-V. But you always have to ensure the use of correct driver for a given hardware. Let's take a better look at how Hyper-V works as a Microkernel Type 1 Hypervisor:

As you can see from the preceding diagram, there are multiple components to ensure that the VM will run perfectly. However, the major component is the Integration Components (IC), also called Integration Services. The IC is a set of tools that you should install or upgrade on the VM, so that the VM OS will be able to detect the virtualization stack and run as a regular OS on a given hardware.

To understand this more clearly, let's see how an application accesses the hardware and understand all the processes behind it.

When the application tries to send a request to the hardware, the kernel is responsible for interpreting this call. As this OS is running on an Enlightened Child Partition (Means that IC is installed), the Kernel will send this call to the Virtual Service Client (VSC) that operates as a synthetic device driver. The VSC is responsible for communicating with the Virtual Service Provider (VSP) on the parent partition, through VMBus, so the VSC can use the hardware resource. The VMBus will then be able to communicate with the hardware for the VM. The VMBus, a channel-based communication, is actually responsible for communicating with the parent partition and hardware.

For the VMBus to access the hardware, it will communicate directly with a component on the Hypervisor called hypercalls. These hypercalls are then redirected to the hardware. However, only the parent partition can actually access the physical processor and memory. The child partitions access a virtual view of these components that are translated on the guest and the host partitions.

New processors have a feature called Second Level Address Translation (SLAT) or Nested Paging. This feature is extremely important on high performance VMs and hosts, as it helps reduce the overhead of the virtual to physical memory and processor translation. On Windows 8, SLAT is a requirement for Hyper-V.

It is important to note that Enlightened Child Partitions, or partitions with IC, can be Windows or Linux OS. If the child partitions have a Linux OS, the name of the component is Linux Integration Services (LIS), but the operation is actually the same.

Another important fact regarding ICs is that they are already present on Windows Server 2008 or later. But, if you are running a newer version of Hyper-V, you have to upgrade the IC version on the VM OS. For example, if you are running Hyper-V 2012 R2 on the host OS and the guest OS is running Windows Server 2012 R2, you probably don't have to worry about it. But if you are running Hyper-V 2012 R2 on the host OS and the guest OS is running Windows Server 2012, then you have to upgrade the IC on the VM to match the parent partition version. Running guest OS Windows Server 2012 R2 on a VM on top of Hyper-V 2012 is not recommended. For Linux guest OS, the process is the same. Linux kernel version 3 or later already have LIS installed. If you are running an old version of Linux, you should verify the correct LIS version of your OS. To confirm the Linux and LIS versions, you can refer to an article at http://technet.microsoft.com/library/dn531030.aspx.

Another situation is when the guest OS does not support IC or LIS, or an Unenlightened Child Partition. In this case, the guest OS and its kernel will not be able to run as an Enlightened Child Partition. As the VMBus is not present in this case, the utilization of hardware will be made by emulation and performance will be degraded. This only happens with old versions of Windows and Linux, like Windows 2000 Server, Windows NT, and CentOS 5.8 or earlier, or in case that the guest OS does not have or support IC. Now that you understand how the Hyper-V architecture works, you may be thinking: "Okay, so for all of this to work, what are the requirements?"

Hyper-V requirements and processor features

At this point, you can see that there is a lot of effort for putting all of this to work. In fact, this architecture is only possible because hardware and software companies worked together in the past. The main goal of both type of companies was to enable virtualization of operating systems without changing them.

Intel and AMD created, each one with its own implementation, a processor feature called virtualization assistance so that the Hypervisor could run on Ring 0, as explained before. But this is just the first requirement. There are other requirement as well, which are as follows:

Virtualization assistance (also known as Hardware-assisted virtualization): This feature was created to remove the necessity of changing the OS for virtualizing it.
On Intel processors, it is known as Intel VT-x. All recent processor families support this feature, including Core i3, Core i5, and Core i7. The complete list of processors and features can be found at http://ark.intel.com/Products/VirtualizationTechnology. You can also use this tool to check if your processor meets this requirement which can be downloaded at: https://downloadcenter.intel.com/Detail_Desc.aspx?ProductID=1881&DwnldID=7838.On AMD Processors, this technology is known as AMD-V. Like Intel, all recent processor families support this feature. AMD provides a tool to check processor compatibility that can be downloaded at http://www.amd.com/en-us/innovations/software-technologies/server-solution/virtualization.
Data Execution Prevention (DEP): This is a security feature that marks memory pages as either executable or nonexecutable. For Hyper-V to run, this option must be enabled on the System BIOS. For an Intel-based processor, this feature is called Execute Disable bit (Intel XD bit) and No Execute Bit (AMD NX bit). This configuration will vary from one System BIOS to another. Check with your hardware vendor how to enable it on System BIOS.x64 (64-bit) based processor: This processor feature uses a 64-bit memory address. Although you may find that all new processors are x64, you might want to check if this is true before starting your implementation. The compatibility checkers above, from Intel and AMD, will show you if your processor is x64.Second Level Address Translation (SLAT): As discussed before, SLAT is not a requirement for Hyper-V to work. This feature provides much more performance on the VMs as it removes the need for translating physical and virtual pages of memory. It is highly recommended to have the SLAT feature on the processor ait provides more performance on high performance systems. As also discussed before, SLAT is a requirement if you want to use Hyper-V on Windows 8 or 8.1. To check if your processor has the SLAT feature, use the Sysinternals tool—Coreinfo— that can be downloaded at http://technet.microsoft.com/en-us/sysinternals/cc835722.aspx.

There are some specific processor features that are not used exclusively for virtualization. But when the VM is initiated, it will use these specific features from the processor. If the VM is initiated and these features are allocated on the guest OS, you can't simply remove them. This is a problem if you are going to Live Migrate this VM from a host to another host; if these specific features are not available, you won't be able to perform the operation. Live Migration and Share Nothing Live Migration will be covered in later chapters. At this moment, you have to understand that Live Migration moves a powered-on VM from one host to another. If you try to Live Migrate a VM between hosts with different processor types, you may be presented with an error.

Live Migration is only permitted between the same processor vendor: Intel-Intel or AMD-AMD. Intel-AMD Live Migration is not allowed under any circumstance. If the processor is the same on both hosts, Live Migration and Share Nothing Live Migration will work without problems.

But even within the same vendor, there can be different processor families. In this case, you can remove these specific features from the Virtual Processor presented to the VM. To do that, open Hyper-V Manager | Settings... | Processor | Processor Compatibility. Mark the Migrate to a physical computer with a different processor version option. This option is only available if the VM is powered off.

Keep in mind that enabling this option will remove processor-specific features for the VM. If you are going to run an application that requires these features, they will not be available and the application may not run.

Now that you have checked all the requirements, you can start planning your server for virtualization with Hyper-V. This is true from the perspective that you understand how Hyper-V works and what are the requirements for it to work. But there is another important subject that you should pay attention to when planning your server: memory.

Memory configuration

I believe you have heard this one before: "The application server is running under performance". In the virtualization world, there is an obvious answer to it: give more virtual hardware to the VM. Although it seems to be the logical solution, the real effect can be totally opposite.

During the early days, when servers had just a few sockets, processors, and cores, a single channel made the communication between logical processors and memory. But server hardware has evolved, and today, we have servers with 256 logical processors and 4 TB of RAM. To provide better communication between these components, a new concept emerged. Modern servers with multiple logical processors and high amount of memory use a new design called Non-Uniform Memory Access (NUMA) architecture.

Non-Uniform Memory Access (NUMA) architecture

NUMA is a memory design that consists of allocating memory to a given node, or a cluster of memory and logical processors. Accessing memory from a processor inside the node is notably faster than accessing memory from another node. If a processor has to access memory from another node, the performance of the process performing the operation will be affected. Basically, to solve this equation you have to ensure that the process inside the guest VM is aware of the NUMA node and is able to use the best available option.

When you create a virtual machine, you decide how many virtual processors and how much virtual RAM this VM will have. Usually, you assign the amount of RAM that the application will need to run and meet the expected performance. For example, you may ask a software vendor on the application requirements and this software vendor will say that the application would be using at least 8 GB of RAM. Suppose you have a server with 16 GB of RAM. What you don't know is that this server has four NUMA nodes. To be able to know how much memory each NUMA node has, you must divide the total amount of RAM installed on the server by the number of NUMA nodes on the system. The result will be the amount of RAM of each NUMA node. In this case, each NUMA node has a total of 4 GB of RAM.

Following the instructions of the software vendor, you create a VM with 8 GB of RAM. The Hyper-V standard configuration is to allow NUMA spanning, so you will be able to create the VM and start it. Hyper-V will accommodate 4 GB of RAM on two NUMA nodes. This NUMA spanning configuration means that a processor can access the memory on another NUMA node. As mentioned earlier, this will have an impact on the performance if the application is not aware of it. On Hyper-V, prior to the 2012 version, the guest OS was not informed about the NUMA configuration. Basically, in this case, the guest OS would see one NUMA node with 8 GB of RAM, and the allocation of memory would be made without NUMA restrictions, impacting the final performance of the application.

Hyper-V 2012 and 2012 R2 have the same feature—the guest OS will see the virtual NUMA (vNUMA) presented to the child partition. With this feature, the guest OS and/or the application can make a better choice on where to allocate memory for each process running on this VM.

Note

NUMA is not a virtualization technology. In fact, it has been used for a long time, and even applications like SQL Server 2005 already used NUMA to better allocate the memory that its processes are using.

Prior to Hyper-V 2012, if you wanted to avoid this behavior, you had two choices:

Create the VM and allocate the maximum vRAM of a single NUMA node for it, as Hyper-V will always try to allocate the memory inside of a single NUMA node. In the above case, the VM should not have more than 4 GB of vRAM. But for this configuration to really work, you should also follow the next choice.Disable NUMA Spanning on Hyper-V. With this configuration disabled, you will not be able to run a VM if the memory configuration exceeds a single NUMA node. To do this, you should clear the Allow virtual machines to span physical NUMA nodes checkbox on Hyper-V Manager | Hyper-V Settings... | NUMA Spanning. Keep in mind that disabling this option will prevent you from running a VM if no nodes are available.

You should also remember that even with Hyper-V 2012, if you create a VM with 8 GB of RAM using two NUMA nodes, the application on top of the guest OS (and the guest OS) must understand the NUMA topology. If the application and/or guest OS are not NUMA aware, vNUMA will not have effect and the application can still have performance issues.

At this point you are probably asking yourself "How do I know how many NUMA nodes I have on my server?" This was harder to find in the previous versions of Windows Server and Hyper-V Server. In versions prior to 2012, you should open the Performance Monitor and check the available counters in Hyper-V VM Vid NUMA Node. The number of instances represents the number of NUMA Nodes.

In Hyper-V 2012, you can check the settings for any VM. Under the Processor tab, there is a new feature available for NUMA. Let's have a look at this screen to understand what it represents:

In Configuration, you can easily confirm how many NUMA nodes the host running this VM has. In the case above, the server has only 1 NUMA node. This means that all memory will be allocated close to the processor.

Note

Multiple NUMA nodes are usually present on servers with high amount of logical processors and memory.

In the NUMA topology