Saving VMs from RAM Shortages: How to Configure SSD Host Cache on VMware ESXi

VMware tutorial - IT technology blog
VMware tutorial - IT technology blog

Quick Start: Configure Host Cache in 5 Minutes

Need to reduce VM lag immediately? Here is a summary of the steps for quick configuration. I assume you have already attached a separate SSD to your ESXi server.

  1. Create Datastore: Go to Storage > New Datastore. Select the SSD and give it a recognizable name (e.g., SSD_Cache_01).
  2. Access Swap Settings: Go to Manage > System > Swap.
  3. Assign the drive: Click Edit settings and select the correct Datastore SSD_Cache_01 you just created.
  4. Allocate capacity: Enter the amount of GB you want to dedicate to the Cache. For a small Lab, 20-40GB is a reasonable number.
  5. Activate: Click Save. ESXi will begin coordinating swap to the SSD instead of pushing it to slow HDDs.

Why Host Cache is a Lifesaver for Lab Environments

When I first started building Labs on older servers like the Dell R610 or HP DL360 G7, I frequently ran into RAM shortages. Just turning on 5 Windows Server VMs would push 32GB of RAM to the 95% threshold. At this point, ESXi triggers the Swap mechanism, using the hard drive as temporary memory.

This is where the nightmare begins. If the Swap file is on an HDD (7.2k or 10k RPM), latency will skyrocket to hundreds of milliseconds. The VMs will lag so badly you won’t even be able to open the Start menu. Meanwhile, a standard SSD can handle tens of thousands of IOPS, making it 50-100 times faster than a traditional HDD.

Host Cache (also known as Swap to Host Cache) creates an intermediate buffer. Instead of writing excess data directly to the HDD, ESXi prioritizes pushing it to the SSD. As a result, VMs remain responsive even when physical RAM is exhausted.

Step-by-Step Setup Guide

Step 1: Prepare the SSD

First, check if ESXi has recognized the device. Go to Storage > Devices. If the SSD shows a status of Not consumed, proceed to create a new Datastore.

An important note: Avoid sharing the SSD where the ESXi OS is installed for Host Cache. This can easily cause I/O bottlenecks, reducing the overall performance of the entire host.

Step 2: Configure via Web Client

Since version 6.7, this process has become much simpler. Follow these steps:

  • Select the Host in the left column of the screen.
  • Go to the Manage tab, then select System.
  • Find the Swap section. Here you will see two partitions: Datastore and Host Cache.
  • Click Edit settings. In the Host cache datastore row, select the SSD you prepared.

Step 3: Command Line Workaround (For SSDs not automatically recognized)

Sometimes consumer-grade SSDs (SATA) are not correctly identified by ESXi. You need to SSH into the server and use commands to “force” the system to understand it is a high-speed drive:

# Check the list of storage devices
esxcli storage nmp device list

# If the drive doesn't show SSD attributes, use the following command to tag it (replace [DEVICE_ID] with the actual ID)
esxcli storage nmp satp rule add -s VMW_SATP_LOCAL --device [DEVICE_ID] --option "enable_ssd"

After running the command, restart the host or rescan storage for the changes to take effect.

Advanced: Critical Notes to Avoid Hardware Failure

Difference Between VM Swap and Host Cache

Don’t confuse the .vswp file with Host Cache. The .vswp file is located in each VM’s directory and usually defaults to the same drive as the VM. Host Cache is a shared buffer for the entire Host. ESXi will prioritize filling the Host Cache on the SSD before touching the Swap file on the HDD.

Choosing an SSD: Don’t go for the cheapest option for Production

Using an SSD for caching will deplete its lifespan very quickly due to the intensity of continuous data writing.
For Labs: Samsung EVO or Crucial MX series are sufficient.
For Production systems: Enterprise SSDs like the Intel DC P-series or Samsung PM are mandatory. These series have extremely high TBW (Total Bytes Written) ratings, allowing them to withstand the pressure of continuous writing and erasing for many years.

System Optimization Tips for Low RAM Situations

Host Cache is an excellent temporary solution, but it’s not a magic bullet. To make your system more stable, you should apply these 3 additional tips, including how to Hot Add CPU and RAM to upgrade resources without rebooting:

  1. Memory Reservation: For critical VMs like Databases, select Reserve all guest memory. This keeps the VM strictly on physical RAM and prevents it from ever being pushed to the SSD.
  2. Install VMware Tools: This is mandatory. The ballooning driver in this toolset helps ESXi reclaim RAM from idle VMs to allocate to those that are actually working.
  3. Monitor Performance: Keep an eye on the Swap-in/Swap-out charts by configuring vSphere Alarms. If this number is consistently above 100kbps, it’s the final signal that you need to purchase more physical RAM.

With just an affordable SSD, you can make an aging server feel significantly smoother. If you are running a home Lab, try this trick immediately. The difference in responsiveness will surprise you.

Share: