<?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>Anchor Web Hosting Blog &#187; swap</title>
	<atom:link href="http://www.anchor.com.au/blog/tag/swap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anchor.com.au/blog</link>
	<description>A view into the Anchor Engineroom</description>
	<lastBuildDate>Wed, 08 Feb 2012 00:51:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>New dedicated server upgrade offering</title>
		<link>http://www.anchor.com.au/blog/2009/10/new-dedicated-server-upgrade-offering/</link>
		<comments>http://www.anchor.com.au/blog/2009/10/new-dedicated-server-upgrade-offering/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 06:54:52 +0000</pubDate>
		<dc:creator>Barney Desmond</dc:creator>
				<category><![CDATA[WTF]]></category>
		<category><![CDATA[gpu]]></category>
		<category><![CDATA[PCIe]]></category>
		<category><![CDATA[ramdisk]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.anchor.com.au/blog/?p=1263</guid>
		<description><![CDATA[This is, of course, a fantastic idea: http://en.gentoo-wiki.com/wiki/Using_Graphics_Card_Memory_as_Swap Anchor loves to stay abreast of the latest performance options. As such, we&#8217;re proud to announce a new range of upgrade options for our dedicated server customers that demand the absolute best in performance for their customers. It makes sense, really. The best our current systems offer [...]]]></description>
			<content:encoded><![CDATA[<p>This is, of course, a fantastic idea:<br />
<a href="http://en.gentoo-wiki.com/wiki/Using_Graphics_Card_Memory_as_Swap"> http://en.gentoo-wiki.com/wiki/Using_Graphics_Card_Memory_as_Swap</a></p>
<p>Anchor loves to stay abreast of the latest performance options. As such, we&#8217;re proud to announce a new range of upgrade options for our dedicated server customers that demand the absolute best in performance for their customers.</p>
<p>It makes sense, really. The best our current systems offer is puny DDR2 memory. Just think of what you could do with several gig of GDDR<strong>5</strong>. That&#8217;s right, <em>FIVE</em>! We&#8217;re now offering upgrade options with Geforce 320 and Geforce 340 cards. If you order one of our higher-specced (2RU) dedicated servers, you can have two of these puppies strapped together for insane amounts of swappiness.</p>
<p><em>Stay tuned for more news on how we&#8217;re rolling out <a href="http://en.wikipedia.org/wiki/Btrfs">ButterFS</a>, phase-change cooling, overvolted Core2 Quad servers, and mass-scale SSD RAID-0 arrays for database optimisation.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anchor.com.au/blog/2009/10/new-dedicated-server-upgrade-offering/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Winning the war on PHP memory leakage</title>
		<link>http://www.anchor.com.au/blog/2008/11/winning-the-war-on-php-memory-leakage/</link>
		<comments>http://www.anchor.com.au/blog/2008/11/winning-the-war-on-php-memory-leakage/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 01:17:53 +0000</pubDate>
		<dc:creator>Barney Desmond</dc:creator>
				<category><![CDATA[FTW]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[leak]]></category>
		<category><![CDATA[logrotate]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[trending]]></category>
		<category><![CDATA[zpush]]></category>

		<guid isPermaLink="false">http://www.anchor.com.au/blog/?p=61</guid>
		<description><![CDATA[One of our dedicated server customers recently had a problem with the machine keeling over and dying for a few days in a row, for no apparent reason. This necessitated a remote reboot of the server to get it running again (we cut the power to both power supplies for a few seconds). The immediate [...]]]></description>
			<content:encoded><![CDATA[<p>One of our dedicated server customers recently had a problem with the machine keeling over and dying for a few days in a row, for no apparent reason. This necessitated a remote reboot of the server to get it running again (we cut the power to both power supplies for a few seconds). The immediate suspicion was faulty hardware, but this should rarely be the case as we put our hardware through a thorough &#8220;burn in&#8221; period before it&#8217;s ever deployed. In addition to this, it was happening pretty regularly in the middle of the day.</p>
<p>After spotting this pattern, a quick look at our trending graphs showed us the problem very clearly. The machine was steadily using all available physical memory. Once this ran out, the system starts pushing data off to swapspace, which is on the disks. Once this runs out the OS simply has no more memory to give. It&#8217;ll start <a title="Wikipedia article on Out Of Memory condition, &quot;oom killer&quot;" href="http://en.wikipedia.org/wiki/Out_of_memory">killing off processes in a desperate attempt to reclaim some memory</a>, but this is rarely successful.</p>
<p><span id="more-61"></span></p>
<p>Curiously, on days that the server didn&#8217;t die we saw a chunk of memory being released early in the morning. This pointed to a maintenance cronjob doing something, but what?</p>
<p><a href="http://www.anchor.com.au/blog/wp-content/uploads/2008/11/mirai_memoryusage.png"><img class="size-medium wp-image-83 alignnone" src="http://www.anchor.com.au/blog/wp-content/uploads/2008/11/mirai_memoryusage-300x128.png" alt="mirai's memory usage" width="300" height="128" /></a></p>
<p>This should more accurately be described as a graph of non-critical memory allocation; buffers and caches can be quickly discarded to free up memory for applications that really need it. Note the sawtooth wave pattern with a period of 1 day.</p>
<p><a href="http://www.anchor.com.au/blog/wp-content/uploads/2008/11/mirai_swapspace.png"><img class="size-medium wp-image-84 alignnone" src="http://www.anchor.com.au/blog/wp-content/uploads/2008/11/mirai_swapspace-300x121.png" alt="mirai's swapspace usage" width="300" height="121" /></a></p>
<p>Swapspace usage can be seen peaking multiple times over the course of a few days, corresponding to times when the server resembled a glorious fireball</p>
<p>We were now well-prepared to catch the system in the act. We kept an eye on trending graphs and waited for the memory usage get out of hand. When we logged in, what we saw was surprising. Apache was consuming vast amounts of memory, highly irregular for a server which has the primary function of a mail server. Having a look at apache&#8217;s logs, we noticed a lot of failed requests to Zpush, an open-source implementation of the MS Exchange protocol for syncing data to mobile clients (iPhones, in this case), written in PHP.</p>
<blockquote>
<pre>PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried
to allocate 727553 bytes) in /home/zpush/zpush/include/mimeDecode.php
on line 292</pre>
</blockquote>
<p>PHP is usually a pretty sturdy beast. It sanitises the environment between requests, effectively <a title="Wikipedia article on sandboxing for isolation" href="http://en.wikipedia.org/wiki/Sandbox_(computer_security)">sandboxing</a> different users&#8217; code from each other. It&#8217;s certainly possible to write pathologically broken code, but generally this shouldn&#8217;t affect anyone badly except for yourself.</p>
<p>For whatever reason, zpush was exceeding its local memory limits in the backend MIME parser and dying. This is a condition that PHP should recover from gracefully, but that clearly wasn&#8217;t happening. With zpush being regularly called by the customer&#8217;s iPhones, this was leaking a little bit of memory every single time. Because apache wasn&#8217;t dying outright, the memory never got freed.</p>
<p>A whole lot of things suddenly made sense. Apache will eventually recycle its processes (after 4,000 requests), but on a lightly-used server like this one, apache was only dealing with zpush requests. Spread over 8 child processes, apache could in theory take some 32,000 hits before it gets close to saving itself. This also had a clean explanation for the early morning respite: logrotate will <a title="USR1 signals a graceful restart of apache" href="http://httpd.apache.org/docs/2.2/stopping.html">signal apache to do a graceful restart</a> after processing the logs for the day, which will restart the child processes, freeing the memory.</p>
<p>In this instance, the most straighforward solution was to disable zpush. If this weren&#8217;t an option then further investigation would be needed. Increasing the PHP memory limit beyond 16MB in php.ini woud do the job, but we&#8217;d really like to know <em>why</em> it&#8217;s trying to allocate so much memory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anchor.com.au/blog/2008/11/winning-the-war-on-php-memory-leakage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

