Formula To See How Much You Save On Physical Memory With VMware PSHARE

Part of the overall memory overcommit feature, VMware has this cool feature called transparent memory page sharing (TPS).

When ESX Server detects an extended period of idleness in the system, the VMkernel begins to compare physical memory pages using a hashing algorithm. After encountering two memory pages that appear to have the same contents, a binary compare is executed to ensure similar content. ESX Server then frees up one of the memory pages by updating the memory mappings for both virtual machines to point to the same physical memory address. Should a virtual machine attempt to write to or modify a shared memory page, ESX Server first copies the shared memory page, so that a distinct instance is created for each virtual machine. The virtual machine requesting the writte operation to the memory page is then able to its contents without affecting other virtual machines sharing this same page.

With memory sharing, a workload consisting of multiple virtual machines often consumes less memory than it would when running on physical machines. As a result, the system can efficiently support higher levels of overcommitment. The amount of memory saved by memory sharing depends on workload characteristics. A workload of many nearly identical virtual machines may free up more than 30 percent of memory, while a more diverse workload may result in savings of less than 5 percent of memory.

Now that we have seen the definition, let’s see how to calculate this number. First you need to install vSphere PowerCLI available here, then you need the Get-Stat2 cmdlet available here. Once you have all these in place and installed, fire up vSphere PowerCLI and browse to the directory where you have the Get-stat2.ps1.

Now here is the formula:  

[math]::round(((Get-View  class=”hiddenSpellError” pre=”Get-View “>-ViewType  “>HostSystem |?{$_.Runtime.ConnectionState -eq “connected”} | %{((((./Get-Stat2.ps1 -entity $_ -stat “mem.shared.average” -Interval RT) | measure-object -Property value -Average).Average) – ((((./Get-Stat2.ps1 -entity $_ -stat “mem.sharedcommon.average”-Interval RT) | measure-object -Property value -Average)).Average))}) | Measure-Object -Sum).Sum /1Mb,2)

Personally my output is 272GB. That is the sum of memory page shared among all my VMs across a bunch of hosts. That’s huge and knowing the price of memory for servers nowadays, I just can tell this features is a must have and so far only VMware has it since … 2001 WOW!

Let’s talk money a bit. I’m running HP blades, BL460’s mainly, 272GB of HP memory is about 80,000Eur knowing that MSRP price list for a 2*4GB PC2-5300 kit is about 2,350Eur , no VAT, no rebate.  With that saving, I paid my VMware licenses!

You can follow real-time the gain by using the performance tab of your vSphere Client. I will post a meaningful picture later. The former one is wrong. Thx to Hypervizor for letting me know 😉



About PiroNet

Didier Pironet is an independent blogger and freelancer with +15 years of IT industry experience. Didier is also a former VMware inc. employee where he specialised in Datacenter and Cloud Infrastructure products as well as Infrastructure, Operations and IT Business Management products. Didier is passionate about technologies and he is found to be a creative and a visionary thinker, expressing with passion and excitement, hopefully inspiring and enrolling people to innovation and change.
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Formula To See How Much You Save On Physical Memory With VMware PSHARE

  1. hypervizor says:

    This is the wrong counter for follow “gain”, you must chose “shared” and BTW must defalcate “shared common” to get the real count (as in the script) 😉

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s