📜 ⬆️ ⬇️

Virtualization: recommendations of leading dog owners

Before building an infrastructure based on virtualization, and even more so to introduce it into commercial operation, it is necessary to ensure that the system resources are used most efficiently and the performance is maximum. In this series of articles, I will give recommendations on how to optimize the system for performance, both from the host side and from the virtual machines side.
image




Let's start with the host


Since servers hosting virtual machines often run at peak loads, the performance of such servers is crucial for the performance of the entire system. Potential "bottlenecks" can be:

Here I will tell you how to identify bottlenecks in all four areas and how to deal with them, and most importantly, how to avoid them.
')
The processor is the heart of the computer

The "heart" of any computer is the processor. And the correctness of the choice of processor in the context of virtualization - it becomes even more important. The processor is the most expensive part of any computer, and the choice of a too powerful processor can lead to unnecessary costs not only for the purchase of the processor itself, but also in the future for electricity and cooling. If the processor is not powerful enough - the system will not be able to provide the necessary performance, which can result in the purchase of a new processor - and, therefore, costs again.
We need to get answers to the following key questions:

Answering these questions is not as easy as it sounds. A simple example: which system to use - dual-processor or four-processor? At the price of dual-processor systems in an unconditional win: the price of one four-processor server is approximately equal to three dual-processor. It would seem that in this case the best solution is to buy three dual-processor servers and combine them into a failover cluster — and you can get a more high-performance and fault-tolerant solution. But on the other hand, in such cases ... There are many new costs:
  1. More software licenses are required - both on the OS and on the management software (SCVMM, SCCM, SCOM, etc.)
  2. Administration costs increase - three servers instead of one
  3. Three servers consume more power, which means they generate more heat and take up more rack space than a single server, albeit a more powerful one.

After that, it may turn out that it would be better to use a four-processor server, which can and will cost a little more and be less fault-tolerant - together with all overhead costs it may still be cheaper.
Nevertheless, the performance of the system as a whole may depend not only and not so much on the processors. Take, for example, a DBMS. In some cases, the requirements for the processor may not be too high, but the disk subsystem can be used very actively. And if in this DBMS business logic and analytics (OLAP, reports) are actively used, then on the contrary, the requirements for the processor and memory can be much higher than for the disk subsystem.
To determine whether the processor is a bottleneck in the system, you need to know how heavily it is loaded. For this, different system utilities can be used. For example, many system administrators are accustomed to using the standard Windows Task Manager. Unfortunately, due to the peculiarities of the Hyper-V architecture, this Task Manager will show not the weather in Honduras, and not the Zimbabwean dollar rate, but only the CPU load of the host OS. Virtual machines will not be taken into account in this case - since the host OS, in the same way as all virtual machines, works in its isolated partition. Therefore, you need to use the Perfmon snap-in. Many administrators, especially those who passed the MCSA exams, know about this utility. For those who still do not know - it starts quite easily: Start - Administrative Tools - Reliability and Performance . From this snap-in, we need the Monitoring Tools - Performance Monitor branch.
With the help of this utility, you can see the values ​​of almost any system parameters, as well as observe their change on the graph. By default, only one parameter is added (in terms of Perfmon - “counter” or “counter”) - “% Processor Time”. This counter shows the same thing as Task Manager - the CPU load of the host OS. Therefore, this counter can be deleted.
We proceed to add counters. Perfmon has many Hyper-V-related counters. Of these, we are currently interested in two:

Note: What is a logical processor? The easiest way to understand this is by example. Suppose if you have one processor with one core, you will have one logical processor. If the processor is dual-core, then there will already be two logical processors. And if he supports Hyper-Threading, there will be four of them.
These two counters will help to get a real picture of the host processor load. The counters are measured in percent, and, accordingly, the closer they are to 100% - the higher the CPU load, and it may be worth considering buying additional or new, more powerful processors.

Memory does not happen much

A powerful processor is good, but with a lack of memory, the system begins to use paging files, and performance begins to fall almost exponentially. As they say on the Internet - "512 megabytes is not a memory, it is insanity."
Unfortunately (and most likely fortunately) in Hyper-V it’s impossible to allocate more memory to virtual machines than is physically present in the system. This is what is called “memory overcommit”, and the marketing of other virtualization solutions vendors plays with such joy. For better or worse, this is a topic for a separate article, and quite a few virtual copies have been broken about this topic.
In this regard, the question arises: how much memory do we need as a result? The answer depends on various factors:

How do we see what happens to memory? Fortunately, you can look through your favorite Task Manager - in contrast to the CPU load, it will show memory usage fairly true. And you can (and even need to) resort to the familiar Perfmon and its Memory / Available Mbytes and Memory / Pages / Sec counters.

Hard drives: how many need them?

As a rule, it is quite difficult to predict how much disk space virtual machines will need to work. And therefore, situations where there is not enough disk space, or vice versa - when there are too many of it and the disks are idle - are quite common.
In addition to volume, there is another very important characteristic - the speed of the disk subsystem. 2 TB of disk space is certainly good, but if these are two SATA disks that are not combined into a RAID array, then the bandwidth may simply not be enough, and this will greatly affect the system performance.
Planning the storage subsystem includes the following aspects:
Controllers. The hard disk controllers can have different bus widths, different cache sizes, and in general their performance can vary greatly. Some controllers are completely “hardware”, that is, they process all requests independently, and some are “half-soft”, that is, the processor of the computer itself performs part of the request processing. The speed of the disk subsystem depends primarily on the type of controller, and you need to choose the controller correctly.
Type of disks. Hard drives, in addition to volume, have many other characteristics that should not be forgotten. This includes the interface type (IDE, SATA, SCSI, SAS), and the spindle speed (7200, 10000, 15000 rpm), and the cache size of the hard disk itself. The difference, for example, between a disk at 7200 and 10000, and even more so - 15000 rpm, or between 8 and 32 MB of cache memory - for such high-load systems as virtualization hosts - is quite high.
The number of disks and the type of RAID array. As already mentioned, sometimes, in order to achieve higher performance and reliability, the best solution would be not to install a single large disk, but to combine several smaller disks into a RAID array. There are several types of RAIDs:

As you can see, the choice of disks is quite a difficult task, so you need to choose, based not only on the requirements for disk space, but also on performance requirements, and of course, from allocated budgets. Sometimes it will be more justified to use external data storage, for example - when it comes to large volumes and / or high performance that cannot be achieved using internal disks. And when infrastructure with high resiliency is planned, then there is certainly no escape from external storage. External storage systems should be selected based on the same principles as internal disks: interface bandwidth, number of disks, type of disks supported by RAID arrays, additional functions such as changing volumes of virtual disks (LUNs) on the fly, the ability to use snapshots, etc.
What about measurements? There are several counters related to the performance of the disk subsystem. Of interest are the following:

These counters show the percentage of time spent reading, writing to disk and, accordingly, the percentage of downtime. If their values ​​rise above 75% for long periods of time, this means that the performance of the disk subsystem is not high enough.
In addition, there are two more counters:

These two counters show the average length of the disk queue, respectively, for reading and writing. High values ​​of these parameters (above 2) for short periods of time (“peaks”) are quite acceptable, and, for example, for DBMS or MS Exchange servers are quite typical, but long-term exceedances indicate that the disk subsystem is probably “narrow” place. "

Network subsystem

The network subsystem is a "bottleneck" much less often than the processor, memory and hard disk, but nevertheless - you should not forget about it.
As with all other components - there are several questions to which it would be nice to get answers at the planning stage:

Depending on the answers, different configuration scenarios for the network subsystem are possible. Suppose we have only one server. It has exactly 4 network interfaces. Only three virtual machines have been launched. The server does not have an Out-of-band-management controller, which means that if something bad happens, you will have to run to the server (which is located at the other end of the city).

At the host level

For servers that do not have remote management hardware, it is recommended that one of the network interfaces be left unused in virtual networks, solely for management tasks. This will greatly reduce the risk of a situation when, due to excessive utilization or due to incorrect settings of the network interface, the ability to remotely manage the server is lost. This can be done either during the installation of the Hyper-V role by unchecking one of the network interfaces, or after installation by removing the virtual network attached to the network interface that will be used for management.
In addition, at the host level, it is imperative to install as much as possible “fresh” drivers for network adapters. This is necessary in order to take advantage of the special functions of network adapters - VLAN, Teaming, TCP Offloading, VMQ (provided that the network adapters themselves support this - as a rule, they are specialized server network adapters).

Network loads

Suppose that our three virtual machines have already worked for some time, and the traffic analysis showed that two of them do not burden the network interface very much, while the third generates very large amounts of traffic. The best solution would be to “release to the world” a virtual machine that generates a large amount of traffic through a separate network interface. To do this, you can create two virtual networks of the External type: one for those virtual machines that do not load the network, and a separate one for the third virtual machine.
In addition, you can create a virtual network with the output "out", while not creating a virtual network adapter in the parent partition. This is done using scripts. I will not go into details, but just give a link: blogs.msdn.com/b/robertvi/archive/2008/08/27/howto-create-a-virtual-swich-for-external-without-creating-a- virtual-nic-on-the-root.aspx

iSCSI

If you plan to use an iSCSI storage system, it is highly recommended to allocate a separate network interface for iSCSI operation, or even two for MPIO operation. If LUNs will be mounted in the host OS, then you just need to leave one or two interfaces unattached to virtual networks. If iSCSI initiators work inside virtual machines, they need to create one or two separate virtual networks that will be used exclusively for iSCSI traffic.

VLAN tagging

VLAN-tagging (IEEE 802.1q) means “marking” of network packets with a special marker (tag), thanks to which a packet can be associated with a particular virtual network (VLAN). In this case, the hosts belonging to different VLANs will be located in different broadcast domains, although they are physically connected to the same equipment. Hyper-V virtual network adapters also support VLAN tagging. To do this, go to the properties of the virtual adapter in the settings of the virtual machine and register the corresponding VLAN ID there.

Active equipment

So far we have talked about network interfaces and virtual network adapters within a host. But it is also necessary to take into account the bandwidth of the active equipment - for example, switches to which our hosts will connect. A simple example: if there is an 8-port 1Gbps switch, and each of the ports utilizes the entire 1Gbps bandwidth, then a 1Gbps uplink will not physically be able to pass through such traffic volumes, which will lead to a drop in performance. This has to be especially taken into account when using iSCSI - the loads there can be high, and packet delays can be quite critical for performance. Therefore, when using iSCSI, it is highly recommended to send iSCSI traffic through separate switches.

Recommendations for the host OS

We now turn to recommendations on the host OS. As you know, Windows Server 2008 R2 can be installed in two different modes: Full and Server Core. In terms of the work of the hypervisor, these modes are no different. Although the Server Core mode seems more difficult at first glance (especially for inexperienced administrators), it is recommended to use this mode. Installing an OS in Server Core mode has the following advantages over a full installation:


Running other applications in the host OS

Running third-party (not related to Hyper-V) applications in the guest OS, as well as installing other server roles besides Hyper-V can lead to a dramatic drop in performance, as well as to a decrease in stability. The fact is that due to the peculiarities of the Hyper-V architecture, all the interaction of virtual machines with devices passes through the parent partition. Therefore, high loads or “falling into the blue screen” in the parent partition will necessarily lead to a drop in performance or simply to a “drop” in all running virtual machines. Here you can (and should) include antivirus software. Whether it is necessary at all on a host that will not do anything except virtualization, is, of course, another question. However, if the antivirus is installed, the first thing to do is to exclude from the list all folders where virtual machine files may be located. Otherwise, the performance may slow down during scanning, and if something similar to a virus is found in any VHD file, then the VHD itself may spoil the anti-virus package when trying to treat it. Similar cases have been observed with MS Exchange databases, and therefore the first recommendation is not to put file antiviruses on Exchange servers at all, and if you do, add folders with databases to exclusions.

Virtual Machine Recommendations


The steps that need to be taken to improve the performance of the virtual machines themselves depend on the applications that will be run on them. Microsoft has recommendations (best practices) for each of the applications - Exchange, SQL Server, IIS, and others. Similar recommendations exist for software of other vendors. Here I will give only general recommendations that are independent of specific software.
It will explain why you need to install Integration Services in the guest OS, how to simplify the deployment of new virtual machines using the VHD library, and how to keep these VHDs up to date with the release of new patches.

Integration services

Integration services are a set of drivers running inside the guest OS. They should be installed immediately after installing the OS. At the moment, the list of supported OS is as follows:

Windows 7 and Windows Server 2008 R2 contain integration services in the installation package, so they do not need to be installed on these OSes additionally.
Installation of integration services allows the use of synthetic devices that have higher performance compared to emulated. Learn more about the difference between emulated and synthetic devices in my article on Hyper-V architecture.
Here is a list of drivers included in Integration Services:

In addition to the drivers listed, the following functions are supported when installing integration services:

To install integration services in Windows OS, select Action - Integration Services Setup . In this case, an ISO-image with installation files will automatically be mounted to the virtual machine, and the installation process will start. If Autorun is disabled on the guest system, the installation process will have to be started manually.
Integration components for Linux are not included in the distribution of Windows Server - they must be downloaded from the Microsoft website.

Sysprep: create a master image

If you have a sufficiently large infrastructure, and you often have to create new virtual machines and install an OS on them, a set of ready-made "master images" of virtual hard disks will save a lot of time. «-», VHD-, , VHD . ( – ).
- :
  1. , , ,
  2. Sysprep, , (SID).

, «mini-setup». , , .

-

-, . , : , - , -. , , – . , , – . , - – «Offline Virtual Machine Servicing Tool». System Center Virtual Machine Manager (SCVMM), WSUS SCCM, , , . :
  1. , SCVMM, – maintenance host.
  2. , .
  3. , VHD- .

Offline Virtual Machine Servicing Tool . – : www.microsoft.com/solutionaccelerators .

Conclusion


, . , - .

Source: https://habr.com/ru/post/99255/


All Articles