<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pivot Point &#187; swap</title>
	<atom:link href="http://vpivot.com/tag/swap/feed/" rel="self" type="application/rss+xml" />
	<link>http://vpivot.com</link>
	<description>Scott Drummonds on Virtualization</description>
	<lastBuildDate>Wed, 08 Sep 2010 08:37:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Optimizing Memory Utilization</title>
		<link>http://vpivot.com/2010/01/06/optimizing-memory-utilization/</link>
		<comments>http://vpivot.com/2010/01/06/optimizing-memory-utilization/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 21:52:45 +0000</pubDate>
		<dc:creator>drummonds</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[esxtop]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ssd]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[vcenter]]></category>

		<guid isPermaLink="false">http://vpivot.com/?p=198</guid>
		<description><![CDATA[My recent series of blog articles have discussed ESX memory management the the performance specter of host swapping.  My last article attempts to correct the misconception that VMware recommends against over-commit memory.   In that article I suggested that memory over-commit is requirement in optimizing memory utilization. Today I want to provide a specific [...]]]></description>
			<content:encoded><![CDATA[<p>My recent series of blog articles have discussed ESX memory management the the performance specter of host swapping.  My last article attempts to <a href="http://vpivot.com/2010/01/04/misunderstanding-memory-management/">correct the misconception that VMware recommends against over-commit memory</a>.   In that article I suggested that memory over-commit is requirement in optimizing memory utilization. Today I want to provide a specific example to show why this is true.   I am have also included tips for identifying host swapping in your environments.<br />
<span id="more-198"></span></p>
<h2>Understanding the Bottleneck</h2>
<p>Let me show the value of over-commit and danger of swapping by way of an example.  I will choose the following typical values to demonstrate my point:</p>
<ul>
<li>All virtual machines are on a single host which has <strong>32 GB of RAM</strong> installed.</li>
<li>Each virtual machine is sized to <strong>8 GB of RAM</strong>.</li>
<li>Each virtual machine has <strong>25% active memory</strong> (%ACTV in esxtop and &#8220;Active&#8221; in vCenter).</li>
</ul>
<table id="newspaper-a">
<tbody>
<tr>
<th>VM Count</th>
<th>Active Memory in Host</th>
<th>Comments</th>
</tr>
<tr>
<td>3</td>
<td>3 * 8 GB * 25% = <strong>6 GB</strong></td>
<td>Without memory over-commit, <em>only 18% of the host&#8217;s memory is actively in use</em>.   What a waste!</td>
</tr>
<tr>
<td>12</td>
<td>12 * 8 GB * 25% = <strong>24 GB</strong></td>
<td>Memory is over-committed by 200% but only 75% is actively being used.  In this aggressive consolidation <em>virtual machines will run at full speed</em> until usage exceeds 100% of host memory.</td>
</tr>
<tr>
<td>18</td>
<td>18 * 8 GB * 25% = <strong>36 GB</strong>, limited to <strong>32 GB</strong> by host</td>
<td>These virtual machines want 36 GB of RAM but are limited to the 32 GB that is installed on the host.  ESX must swap to allow these machines to run and <em>performance will suffer greatly</em>.</td>
</tr>
</tbody>
</table>
<p>A virtual machine&#8217;s active memory is dictated by the application and its usage.  But the VI admin has complete control over the number of virtual machines in the environment which means host active memory can be influenced by adding or removing virtual machines.  Because virtual machine active memory is always equal to or less than 100% the only way to drive the host active memory to 100% is to over-commit memory.   <em>This is why hypervisors that do not support memory over-commit are simply not viable for data centers where memory optimization is a priority.</em></p>
<h2>Identifying and Correcting the Bottleneck</h2>
<p>The ongoing occurrence of swapping is identified by a non-zero swap rate in either esxtop or vCenter.  In addition to swap rate, esxtop provides a swap wait time in its CPU panel.  When swap rate exceeds hundreds of kilobytes per second or swap wait time exceeds a couple percentage points, it is time for corrective action.</p>
<p>There are three possible solutions to this problem:</p>
<ol>
<li>Balance the virtual machines&#8217; memory usage by moving virtual machines from hosts with higher amounts of memory usage to hosts with lower amount of memory usage.</li>
<li>Run fewer virtual machines.</li>
<li>Buy more memory.</li>
</ol>
<h2>Designing Your Infrastructure to Simplify Memory Management</h2>
<p>Ultimately I owe you a full white paper on memory management to provide a sufficient answer.  But I want to give you two ideas of the tools and techniques that I will be describing when in this future paper.  First, place <a href="http://vpivot.com/2009/12/24/solid-state-disks-and-host-swapping/">host swap files on solid state disk (SSD) stores</a> to improve their performance.  With the right SSD device it may be possible to eliminate swap penalties.  Second, even if SSDs are unavailable consider consolidating multiple swap files onto a single store.  This will make swap rate monitoring very easy but may compound the performance penalties of swapping.</p>
<p>Stay tuned and VMware will provide more documentation on memory management in 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://vpivot.com/2010/01/06/optimizing-memory-utilization/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Misunderstanding Memory Management</title>
		<link>http://vpivot.com/2010/01/04/misunderstanding-memory-management/</link>
		<comments>http://vpivot.com/2010/01/04/misunderstanding-memory-management/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 17:26:37 +0000</pubDate>
		<dc:creator>drummonds</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://vpivot.com/?p=176</guid>
		<description><![CDATA[Twice in 2009 someone showed me competitive literature from Microsoft or Citrix claiming that VMware recommends against memory over-commitment.  Given the wide variety of literature we have provided in support of this feature, all of our customers recognize the absurdity of our competitions&#8217; claims.  VMware and its customers love memory over-commitment.  Then where is the [...]]]></description>
			<content:encoded><![CDATA[<p>Twice in 2009 someone showed me competitive literature from <a href="http://blogs.technet.com/jamesone/archive/2009/12/21/drilling-into-reasons-for-not-switching-to-hyper-v.aspx">Microsoft</a> or Citrix claiming that VMware recommends <em>against</em> memory over-commitment.  Given the wide variety of literature we have provided in support of this feature, all of our customers recognize the absurdity of our competitions&#8217; claims.  VMware and its customers love memory over-commitment.  Then where is the source of this misinformed guidance?</p>
<p><span id="more-176"></span>I believe we know the text that is misrepresented.  It comes from our performance best practices document and could be misunderstood by someone to whom the terms &#8220;working set&#8221; and &#8220;active memory&#8221; are unfamiliar.  Here is the sentence, quoted from the <a href="http://www.vmware.com/pdf/vi_performance_tuning.pdf">oldest available version of our best practices document</a>:</p>
<blockquote><p>Swapping is used to forcibly reclaim memory from a virtual machine when both page sharing and ballooning fail to reclaim sufficient memory from an overcommitted system. If the working set (active memory) of the virtual machine resides in physical memory, using the swapping mechanism and having inactive pages swapped out does not affect performance. However, if the working set is so large that active pages are continuously being swapped in and out (that is, the swap I/O rate is high), then performance may degrade significantly.</p></blockquote>
<p>This excerpt describes the condition under which a host will swap.  That condition is best summarized as &#8220;the sum of the working sets of all virtual machines exceeds the amount of memory on the host&#8221;.  This definition presupposes that the reader understands the definition of a working set, which I think some readers may not.  For this discussion I will simplify the definition of working set as &#8220;recently active memory&#8221; and refer readers to their helpful search engine for a more complete description.</p>
<p>When a system&#8217;s working set exceeds available memory, the system will swap.  This is not unique to virtual, consolidated workloads.  As long as operating systems have implemented virtual memory, there existed a possibility that a working set could exceed available physical memory.  The only thing that has changed in a virtual environment is that the working set is calculated by summing the working sets from multiple virtual machines as opposed to a single application or operating system instance.</p>
<p>But the key here&#8211;and the reason why memory over-commitment remains so powerful&#8211;is that <em>allocated memory</em> (the virtual machine&#8217;s size) exceeds <em>active memory</em> (the working set) nearly 100% of the time.  Memory management in consolidated environments is about pushing a host&#8217;s active memory to as close to 100% as possible.  This is something that was not possible in physical environments, and cannot be done in virtual environments without over-commitment.</p>
<p>To sum this up, not only does VMware recommend some over-commitment, but we know that it is impossible to fully use your available memory without the flexibility provided by over-commitment.</p>
]]></content:encoded>
			<wfw:commentRss>http://vpivot.com/2010/01/04/misunderstanding-memory-management/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Solid State Disks and Host Swapping</title>
		<link>http://vpivot.com/2009/12/24/solid-state-disks-and-host-swapping/</link>
		<comments>http://vpivot.com/2009/12/24/solid-state-disks-and-host-swapping/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 01:15:45 +0000</pubDate>
		<dc:creator>drummonds</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[esxtop]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ssd]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[vmkernel]]></category>

		<guid isPermaLink="false">http://vpivot.com/?p=183</guid>
		<description><![CDATA[Recently I have been thinking, talking, and writing about ESX host memory swapping a lot.  ESX swaps memory under the same conditions that traditional operating systems do; the application(s) is using more memory than available on the physical hardware.  Host swapping is an unavoidable consequence of this condition, whether virtualization is present or not.
But a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been thinking, talking, and <a href="http://vpivot.com/2009/12/23/your-performance-enemy-host-swapping/">writing</a> about ESX host memory swapping a lot.  ESX swaps memory under the same conditions that traditional operating systems do; the application(s) is using more memory than available on the physical hardware.  Host swapping is an unavoidable consequence of this condition, whether virtualization is present or not.</p>
<p><span id="more-183"></span>But <a href="http://communities.vmware.com/blogs/chethank/2009/12/22/using-solidstate-drives-to-improve-performance-of-sql-databases-on-vsphere-hosts-when-memory-is-overcommitted">a recent article</a> by my engineering colleague Chethan Kumar shows an avenue that allows VI admins to aggressively over-commit memory and avoid the catastrophic performance penalty of swapping: use solid state disks to host ESX swap files.</p>
<p>The fundamental problem with host swapping comes from the high latency of traditional disks compared to memory.  Data can be retrieved from memory in nanoseconds but takes milliseconds to fetch from a hard drive.  That means a single 4K memory page takes 100,000 times longer to retrieve if the operating system swapped it out.</p>
<p>The value that solid state disks offer to this problem is exceptional latency, as compared to traditional drives.  The SSD that Chethan used showed microsecond latencies, about 1,000 times lower than physical disks.  This means that  time spent waiting for swap activity* has been decreased to 0.1% of the time spent swapping to physical disks.</p>
<p>The importance of fast swap files is that it enables administrators to more aggressively over-commit memory.  Today our admins rightfully fear the VMs&#8217; aggregate active memory exceeding the available physical memory, which results in swapping.  Today SSD technology in shared storage such as EMC&#8217;s new CLARiiONs allows our admins to cleverly place swap files and drive up memory utilization to previously unheard of levels.  This may enable standard memory overcommitment of 200% or more, with extreme over-commit being much higher than this.</p>
<p>In future versions of ESX we want to automate the usage of SSDs to maximize the use of available memory.  But that&#8217;s a roadmap discussion that I will leave for another day.</p>
<p>(*) This swap wait time has conveniently been added to ESX 4&#8217;s version of esxtop under the counter %SWPWT.  See <a href="http://communities.vmware.com/docs/DOC-9279">Interpreting esxtop Statistics</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://vpivot.com/2009/12/24/solid-state-disks-and-host-swapping/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Your Performance Enemy: Host Swapping</title>
		<link>http://vpivot.com/2009/12/23/your-performance-enemy-host-swapping/</link>
		<comments>http://vpivot.com/2009/12/23/your-performance-enemy-host-swapping/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 18:43:57 +0000</pubDate>
		<dc:creator>drummonds</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[vmkernel]]></category>

		<guid isPermaLink="false">http://vpivot.com/?p=178</guid>
		<description><![CDATA[Three times in the past week I have engaged in challenging discussions on host memory swapping and its impact to performance.  If you read my article on host swapping and the whitepaper it summarized, you know the deleterious effect on performance caused by host swapping.  When reading the paper, one of our most astute customers [...]]]></description>
			<content:encoded><![CDATA[<p>Three times in the past week I have engaged in challenging discussions on host memory swapping and its impact to performance.  If you read <a href="http://vpivot.com/2009/09/25/esx-memory-management-ballooning-rules/">my article on host swapping</a> and <a href="http://www.vmware.com/resources/techresources/10062">the whitepaper it summarized</a>, you know the deleterious effect on performance caused by host swapping.  When reading the paper, one of our most astute customers saw a sentence that gave him pause:<br />
<span id="more-178"></span></p>
<blockquote><p>ESX attempts to mitigate the impact of interacting with guest operating system memory management by randomly selecting the swapped guest physical pages.</p></blockquote>
<p>This customer has read some of our other documentation and knows that the vSphere client and esxtop report active and touched memory, each representing a kind of working set.  &#8220;So,&#8221; the customer asks me, &#8220;if ESX is keeping working sets, why would choose swap pages randomly instead of selecting inactive pages outside of the working set?&#8221;  If ESX could choose only inactive pages then the penalty due to host swapping would drop greatly.</p>
<p>As it turns out, ESX does not track working sets.  For ESX to know which pages are actively being read it would have to trap every memory access, which would greatly hurt performance.  Instead, we track a small sample of the host&#8217;s memory&#8211;exactly 100 pages&#8211;to extrapolate the size of active memory.  Because sample-based calculations are accurate with the square of the sample size, a 100 page sample delivers a very high accuracy of active memory.  But, because it is only a sample, the activity on the great majority of pages is a mystery.</p>
<p>This means that ESX has absolutely no information on the read and write behavior of most memory on the system.  Guest operating systems fare no better in tracking working sets.  But because they can categorize pages based on usage&#8211;application heap, buffers for IO, kernel memory, etc.&#8211;guest OSes can make better decisions about which pages should be swapped and which should not.  For this reason the balloon driver can induce non-harmful guest paging which is superior to host swapping.</p>
]]></content:encoded>
			<wfw:commentRss>http://vpivot.com/2009/12/23/your-performance-enemy-host-swapping/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
