Modern virtual infrastructures are extremely complex systems, and even the most experienced administrators can...
get overwhelmed. An increasingly common problem admins encounter is trying to locate the cause of performance issues in the data center. In order to effectively manage your VM resources and optimize performance, you need a clear picture of the way those resources interact with one another and an idea of the tools and strategies available to you.
These five quick tips cover best practices for CPU, memory, storage and network resource utilization, and they provide simple ways to find and reclaim wasted resources when cleaning up your data center.
Master vCPU allocation
Although processors have evolved to increase performance, you still need to ensure you provision the right amount of vCPUs to each VM. You might think that when you overprovision vCPUs, you'll achieve better utilization or performance, but the workload won't use more than it needs. Also, other VMs can't take advantage of unused vCPUs that have already been assigned, so those VM resources are essentially wasted. Your best bet is to closely monitor utilization and keep it around 80%, so processor resources don't become overloaded.
When you use hyper-threading technology, it's especially important to give careful consideration to how you provision vCPUs. While a hyper-threaded CPU is technically considered two vCPUs by the hypervisor, the second process might perform slower than the first process. To combat this, try to assign vCPUs from different cores to a workload to achieve better performance. Using affinity and antiaffinity rules can help you assign certain CPUs to VMs and restrict which CPUs a specific VM can use.
Manage virtual memory
Proper allocation of VM resources is also important when it comes to memory. One key difference between vCPUs and memory, however, is it's better to overprovision memory resources, rather than allocating too few resources. If you don't provision enough memory, the OS will start swapping pages to disk, which can negatively affect performance when done excessively.
In addition to proper sizing, there are several memory management techniques you can use to achieve optimal performance. Page sharing saves redundant content as a single copy that all the VMs can reference, essentially freeing up space. Memory ballooning is used when a VM is close to using up the memory previously allocated to it and there isn't enough left on the host system to allocate more. In this case, the hypervisor will free up those memory pages that aren't as much of a priority.
Disk swapping can be used as a last resort, if need be, but consider combining it with compression to reduce performance degradation. Also, consider configuring a swap-to-host cache for lower latency.
Prevent VM storage problems
To provide adequate VM resources, you need to consider what role storage plays in your environment. For example, inactive VM images might reside in storage, but they are started using CPU and memory, so it's important to be aware of storage capacity and performance as it relates to other resources.
Placing too many VMs on the same logical unit number can increase I/O requests, which can lead to storage contention and performance issues. You can use a functionality provided by the hypervisor called queue depth throttling, which reduces the number of I/O request failures and, as a result, reduces the number of forced retries.
Some hypervisors can also dynamically allocate storage I/O during resource contention using a system of disk shares, thus avoiding any negative performance implications. In addition, you can apply IOPS limits to control a VM's I/O utilization, use specific storage I/O control features to get a high-level resource evaluation and implement different tools to monitor storage latency.
Optimize network performance
Networking is another key virtual resource in your environment, as it affects the way VMs interact with storage and one another. When you configure network capabilities, use multiple network interface cards (NICs) so VMs aren't competing for a limited bandwidth. Better yet, use fast NICs that can handle multiple VMs, if possible. Another thing you should consider is the way you organize VMs. If you put VMs that frequently exchange traffic with one another on the same host, that traffic can simply go through the host's virtual switch without having to go through the physical network first.
Newer command sets, like Intel Virtualization Technology for Directed I/O and Advanced Micro Devices I/O Virtualization Technology, will enable direct access to physical NICs, which requires less overhead than traditional resource abstraction. But they aren't always compatible with certain hypervisor features, so keep that in mind before adopting them. You should, however, take advantage of technologies that allow you to reserve network traffic by type. That way, you can prevent one traffic type from using excessive bandwidth needed by other workloads.
Avoid wasting VM resources
When it comes to potentially wasted resources, the first place you should look is storage. Check for anything that might be considered stale data, like service packs and installations. It's important to clean up CPU and memory, as well. When importing old machines, uninstall any vendor-specific hardware drivers and applications you don't need anymore. Also, remove redundant monitoring tools.
When evaluating VMs, gather performance data over a period of time and then establish a resource baseline to see what each VM actually needs. Finally, check for VM sprawl and continue to do so as you make changes. Proper resource utilization equates to an agile and cost-effective virtual environment.