What is Virtual Memory (vRAM): An Introduction

September 9th, 2019

Reading Time: 10 minutes

The Virtual Machine

There are 3 main components to running a virtual machine:

  1. CPU
  2. RAM
  3. Disk Space

While there are also other vital requirements — such as the network interface card (NIC), CD/DVD drive, and video card — those components are not required to be configured to create a virtual machine. This post will focus on the RAM component and more specifically, virtual memory (vRAM).

Determine Your Virtual Memory Requirements

Before you begin building your virtual machine, you need to determine your machine’s function and plan the virtual memory resources accordingly.

For example, if you are running a Windows Server 2012 R2 machine, the minimum requirement is 512MB of RAM. However, depending on the server’s purpose, the RAM will most likely need to be increased. If that server were to be a mail server running Exchange 2013, it would need at least 8GB of RAM as that is Microsoft’s requirement…quite a range.

Consider Your Virtual Memory Settings

Configuration can begin once you know what resources are required for your server. There are a few different settings we need to configure for this machine:

  • Shares
  • Reservation
  • Limit

The shares state the priority for the virtual machine if there happen to be more memory available than the set reservation. The reservation is the lowest amount of RAM you want the system to have. Seeing as the Exchange 2013 server requires at least 8GB of RAM, we would not want to use less than that, so our reservation would be set to 8GB. Next is the limit, which is the maximum amount of physical memory that the host can assign to the virtual machine. If we did not want the machine to consume more than 10GB of the host’s memory, we would set that limit to 10GB.

Depending on the number of virtual machines that a host has, there can be memory over commitment setup. An example of over commitment would be if a host with 12GB of RAM is running with 4 virtual machines. Each machine could be configured for 4GB of RAM. While it looks like 16GB of RAM in total would be required, it is unlikely that each machine would be using the full 4GB of RAM as one of the machines could be using only 1GB of RAM and essentially freeing up the other 3GB. This is a memory management technique the VMware vSphere Hypervisor ESXi host utilizes that allows the virtual machines to use more memory than the physical host has available. This typically happens when one of the virtual machine runs idle so the ESXi host will transfer memory to one of the other servers that might be under a heavier load. If one of the servers should always have 4GB allocated to it then the reservation needs to be set on that virtual machine for 4GB.

How to Use Memory Ballooning

The host uses memory ballooning to recover unused memory from its virtual machines. Once any unused memory is recovered, it will make it available to the other virtual machines.

Memory ballooning also allows for more memory to be used by the virtual machine than what the host has available, much like over commitment. If the host runs low on physical memory resources, memory ballooning will assign the memory selectively to the virtual machines. The host uses a “balloon driver” which runs inside the virtual machine to determine how much unused memory it can retrieve.

There can be some issues with memory ballooning however.

  • If the driver ends up trying to allocate more memory to a VM than what the host physically has, then it will try and use memory swapping.
  • When a virtual machine is powered on, a separate swap file for the virtual machine is created. If necessary, the hypervisor can directly swap out guest physical memory to the swap file, freeing the host’s physical memory for other virtual machines. This takes time, as well as slows down the virtual machine, depending on the amount of memory to recoup.

While is it not bad for memory ballooning to happen once in a while, it’s best to plan ahead to make sure the proper resources are in place for each virtual machine. Even after the virtual machines have been deployed, using monitoring solutions such as VMware’s vCenter Operations Manager to monitor the resources of the virtual machines can help keep all the operations running smoothly.

Leave a Reply

Let's Talk