วันอังคารที่ 4 มีนาคม พ.ศ. 2557

ESXi 5.x SSD Host Cache Configuration "Swap to Host Cache"


ESXi 5.x SSD Host Cache Configuration "Swap to Host Cache"

A new feature of ESXi 5.x is the ability to use an SSD Datastore to swap to a faster medium than a standard HDD when memory overcomitting.  This is a second to "last hit" method when your host starts to run out of available memory.  The VMs swap file does not reside directly on the SSD.
ESXi uses five memory management mechanisms to handle overcommitting memory.  Page Sharing, Balooning, Memory Compression, Swap to Host Cache, and Regular Swapping.  Instead of directly swapping to disk the ESXi host will use the SSD in between for faster swapping.  Yea can read all about it in the Performance Best Practices for VMWare vSphere 5.1document from VMWare.
To set this feature up connect an SSD to your system.  Depending on the connection extra steps may need to be taken to get vCenter to see it as an SSD.
Select the Configuration tab in vCenter and under Software to the left is a new option "Host Cache Configuration".  If you have already created the datastore on your host your drive should be listed.  If not select Add Storage and create a new datastore selecting the SSD.
Here is where you may get stuck if vCenter cannot recognize the new datastore as being an SSD.  To work around this we need to connect to the host via SSH.  To start SSH select Security Profile just above Host Cache Configuration.  Under services select Properties.  Select SSH and click the Options button.  Click start and OK your way back to the main vCenter window.
SSH into your ESXi host and run the following command,
esxcli storage nmp device list
In the returned results you should see all of your attached drives.  Match the drive with the naa id from the vCenter GUI under Storage.
vCenter Datastore NAA ID
ESXi nmp device list
Take note of the "Storage Array Type:" as you will need this in a moment.  List out this device in further detail using the following command replacing your naa id,
esxcli storage core device list -d naa.6001e4f01550370018dff84814c293a6
In the returned section you should find "Is SSD:"
SSD Details
To fix this we need to setup a rule to trick vCenter into seeing it as an SSD.  This should work for any type of drives you are trying to use.
esxcli storage nmp satp rule add -s VMW_SATP_LOCAL –d naa.6001e4f01550370018dff84814c293a6 –o enable_ssd
Change the section after -s to match your drive as well as inserting your own naa id.  To verify the rule was added run the following command,
esxcli storage nmp satp rule list | grep enable_ssd
Now reclaim your drive to apply the new rule,
esxcli storage core claiming reclaim -d naa.6001e4f01550370018dff84814c293a6
Note: If you get an error trying to reclaim the datastore check to make sure that the ESXi host did not automatically use it for other functions such as Datastore Heatbeating.
Reload and run the claim rules,
esxcli storage core claimrule load
esxcli storage core claimrule run
List out the device again and the "Is SSD:" should be set to true now.  You may need to refresh the Host Cache Configuration screen to get the drive to show up properly.  Once you see your datastore right click and select properties.
ESXi SSD Host Cache Setup
Select the size you want to allow from the datastore for host swap caching and click OK.  You should now see the drive use up the select space and fill it full of vswap files.  If not click refresh and it should update.
Browsing the datastore we see a new folder and a 1GB swp file.  Inside the folder should be a number of 1GB vswap files depending on how big you allocated the datastore.
SSD Cache Drive Datastore
SSD Cache Drive Datastore 2

Credits to lamw here for the initial posting on this new feature.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น