Sergey Nivens - Fotolia
IT administrators can use sizing and memory management strategies to optimize virtual memory and improve system performance. Before admins use these memory optimization methods, they should consider their workload requirements, including CPU and storage.
Memory management strategies, such as memory ballooning, are essential components of a properly functioning system. Without them, admins risk resource contention and inadequate system performance. But admins should optimize memory cautiously because some tactics have issues, such as prolonged downtime.
Optimize memory resources in a virtual environment
To optimize memory resources, admins can either select the exact amount of memory required to run a VM or enable system features to improve memory use for VMs with fluctuating resource requirements. Too little memory and the system uses page files, which can harm performance. Admins risk resource contention if they allocate too much memory.
Admins can use memory ballooning, dynamic allocation, paging, overcommitment, mirroring, swapping and transparent page sharing (TPS) to govern and distribute resources.
Essential memory management strategies to optimize virtual memory
Admins can distribute memory and dictate how VMs use it with optimization tactics. Some common memory management techniques include:
Memory ballooning lets a physical host temporarily assign unused memory from one guest VM to another with a balloon driver. A balloon driver resides within each VM and locks any unused memory. The balloon driver then communicates with the hypervisor, which allocates that memory to other VMs. But memory ballooning can introduce performance issues if VMs no longer have the amount of memory they require.
Dynamic memory allocation
Dynamic memory allocation lets admins automatically assign memory to VMs. VMs claim the exact amount of memory they require from a physical resource pool. The hypervisor then monitors and redistributes memory according to fluctuating workload demands. Admins can overprovision memory with dynamic allocation, which enables the hypervisor to use paging or swapping. But overprovisioning can lead to low physical memory and inefficient performance.
Memory paging occurs when VM memory runs low and the hypervisor temporarily transfers data from the host's memory to a hard disk or solid-state drive (SSD). Sections of the hard disk or SSD known as page files serve as an extension of the main memory. Paging ensures VMs don't run out of memory and crash. But paging can harm application performance; use it only when other memory management strategies aren't available.
Similar to paging, swapping enables admins to switch entire processes out of a system's memory to a storage disk. Paging is more efficient because it operates at the page level, whereas swapping uses multiple pages to swap entire processes. As a result, the hypervisor uses swapping as a last resort when other memory management strategies aren't sufficient.
Admins can use memory overcommitment as both a management technique and an operating condition. As a technique, it allocates more memory to VMs than the total physical memory available. As an operating condition, overcommitment actively consumes more physical memory than what's available. Overcommitment can improve memory usage, but it can also cause the hypervisor to swap files with the storage device to reallocate memory, which can harm VM performance.
Memory mirroring divides a host's physical memory into two separate channels. The host then copies one of the channels to the other to create a copy, which provides fault tolerance.
Transparent page sharing
TPS condenses identical pages into a single page. Multiple VMs that run the same OS often have identical memory pages. TPS calculates hash values for each page to verify which pages are identical and consolidates them into a single page. TPS helps consolidate memory, but it also takes longer to execute and introduces security vulnerabilities such as unauthorized access to sensitive data.
Pros and cons of right-sizing techniques for memory optimization
Right-sizing VMs enables admins to reduce resource contention and improve system performance. To right-size VMs, admins must consider system metrics such as CPU, memory, I/O and networking.
Admins can determine in what areas to adjust if they monitor system metrics with appropriate software. If admins plan to grow their VMs quickly, they must balance memory to prevent resource contention.
It can be a challenge to right-size VMs. Admins must shut down a VM to reduce allocated resources, which can limit remote access and lead to prolonged startup times. Admins must plan appropriately and schedule optimization efforts with software updates and patches to prevent unnecessary downtime.
Admins also risk pushback from application owners. To prevent this, admins should communicate with application owners about exact optimization efforts prior to any changes.