Anytime there are performance issues, no one is happy. But when there are memory issues, it can be extra aggravating. If you want to take full advantage of the memory that your servers contain, there are important memory management techniques that you should know.
If you want to consolidate duplicate files or, on the contrary, if you want to copy files just in case of an error, these techniques can handle that. If you need more memory than your physical server has, or if your physical server needs to retract memory from virtual machines, these techniques give you that option.
Running out of memory and need more? One of the approaches to memory paging is memory ballooning, a technique that will free up unused memory when the amount of physical memory is running low. Balloon drivers in each virtual machine (VM) identify unused memory and make it available to the host. If a VM is only using half of the memory it has been allocated and the server is in need of more space, memory ballooning can make that memory available.
For example, if a VM was allocated 10 GB of memory but is only using 5 GB, but other VMs on the same host are running low on memory, there is plenty of available space. Balloon drivers will determine where the extra memory is and make it available to other VMs.
Controlling how a computer's or VM's memory resources are shared is handled by memory paging. This technique divides memory into fixed-size pages and makes data you're looking to access available quickly. Memory paging allows a computer to make up for low memory by using part of its hard drive for memory. For example, if a server is using all of its memory, instead of running terribly slow or stopping, it could assign part of its hard drive to act as additional memory. One downside to memory paging is that hard drives are slower than memory. So, memory paging should be treated as just a temporary fix to a larger problem.
Do you find yourself needing more memory? Memory overcommit -- also known as overcommitment -- allows VMs to use more memory than the physical host actually has available. The idea behind this practice is that not every VM will need to use all of its available memory at a given time. There are positives and negatives to this technique. A physical host might allow VMs more RAM then it can hold but it doesn't mean all of that virtual memory will actually be used. If each VM is allocated 2 GB, it doesn't mean that each VM will actually use it all. One VM might use all of that memory, but unused memory on other VMs keep a balance. However, if every VM uses the additional memory, there could be performance issues because the physical host can't handle it.
Memory mirroring is one of the simplest techniques there is. Memory mirroring separates physical memory into two logical channels and mirrors the first channel to the second channel. This approach is similar to RAID1 in storage. If something does happen, the memory controller uses the second channel, which contains the copy, and work can resume without downtime. After the first copy is repaired, the memory controller switches back to the original. This is a proactive and reliable approach when it comes to disaster recovery. One negative to this approach is the price, as memory mirroring predictably costs double.
Transparent page sharing
Transparent page sharing consolidates redundant memory pages into one single page. With many different VMs running on one physical server and many of them running the same operating system, duplicate information will exist. The hypervisor will identify which pages are the same and turn them into one single page that is shared through all of the VMs, which will free up more memory.