<?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>Technologist For Hire &#187; cache</title>
	<atom:link href="http://www.nexdot.net/blog/tag/cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nexdot.net/blog</link>
	<description>An everyday attempt to stand out</description>
	<lastBuildDate>Tue, 09 Feb 2010 20:24:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1-alpha-15359</generator>
		<item>
		<title>WinCache, Apache and a pretty graph!</title>
		<link>http://www.nexdot.net/blog/2010/02/09/wincache-apache-and-a-pretty-graph/</link>
		<comments>http://www.nexdot.net/blog/2010/02/09/wincache-apache-and-a-pretty-graph/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 19:57:25 +0000</pubDate>
		<dc:creator>Christian Flickinger</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[eAccelerator]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[opcode]]></category>
		<category><![CDATA[wincache]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xcache]]></category>

		<guid isPermaLink="false">http://www.nexdot.net/blog/?p=146</guid>
		<description><![CDATA[I really wanted to focus this post on WinCache, rather than OpCode Cachers in general &#8211; but it turned into a general post with a star contender. From the Windows Cache extension for PHP website as Microsoft.com: Windows Cache Extension for PHP is a PHP accelerator that is used to increase the speed of PHP [...]]]></description>
			<content:encoded><![CDATA[<p>I really wanted to focus this post on WinCache, rather than OpCode Cachers in general &#8211; but it turned into a general post with a star contender. From the <a href="http://www.iis.net/expand/WinCacheForPhp" target="_blank">Windows Cache extension for PHP website</a> as Microsoft.com:</p>
<blockquote><p>Windows Cache Extension for PHP is a PHP accelerator that is used to increase the speed of PHP applications running on Windows and Windows Server. Once the Windows Cache Extension for PHP is enabled and loaded by the PHP engine, PHP applications can take advantage of the functionality without any code modifications.</p></blockquote>
<p>The documentation makes no mention of Apache, only IIS. I decided to give it a try, and to my amazement, WinCache worked in Apache on Windows. After that I decided to compare the performance of WinCache with the other available options for Windows+Apache.</p>
<p>I referenced the following sites who performed similar tests, but in IIS:</p>
<ul>
<li><a href="http://techportal.ibuildings.com/2009/11/19/php-on-windows-the-wincache-1-0-benchmark/" target="_blank">PHP on Windows: The WinCache 1.0 Benchmark &#8211; ibuildings.com techPortal, Ivo Jansch</a></li>
<li><a href="http://blog.calevans.com/2009/09/06/wincache/" target="_blank">WinCache – Preliminary tests look REALLY good. &#8211; Cal Evans</a></li>
</ul>
<p>You can grab WinCache, and information about it, here:</p>
<ul>
<li><a href="http://www.iis.net/expand/wincacheforphp" target="_blank">Windows Cache extension for PHP</a> website on Microsoft.com</li>
<li><a href="http://pecl.php.net/package/WinCache" target="_blank">The PECL repository page</a> for WinCache</li>
<li><a href="http://ruslany.net/tag/wincache/" target="_blank">Ruslan Yakushev&#8217;s blog posts about WinCache</a> (WinCache Developer)</li>
</ul>
<h2>Testing Environment</h2>
<ul>
<li>Hardware
<ul>
<li>AMD Athlon 64 3800+ (2.50GHz, single core)</li>
<li>2.0GB DDR2</li>
</ul>
</li>
<li>Software
<ul>
<li>Windows Server 2003 w/ SP2</li>
<li>MySQL 5.1.40, locally installed</li>
<li>Apache 2.2.14 vc9</li>
<li>mod_fcgid 2.3.4</li>
<li>php 5.3.1 ts/nts vc9</li>
<li>WordPress 2.9.1 base install (wordpress is a good &#8220;everyman&#8221; product for simulating &#8220;real world&#8221; use, even if its code is ugly)</li>
</ul>
</li>
<li>OpCode Cachers
<ul>
<li>APC 3.1.3.0 (3.1) (NTS)</li>
<li>WinCache 1.0.1117.0 (1.0, stable) (NTS)</li>
<li>XCache 2.0.0-dev(r688) (TS)</li>
<li>eAccelerator 0.9.6rc1 (TS)</li>
</ul>
</li>
</ul>
<h2>Test Method</h2>
<p>To run an unbiased test, I tried to remove as many variables as possible. A batch script was written to perform the following (thus garaunteeing that every test was identical):</p>
<ol>
<li>Stop the apache service</li>
<li>Start the apache service</li>
<li>Run ab (Apache Bench), piping output to a text file</li>
<li>Repeat 1-3 with incremented Concurrency levels (1, 3, 5, 10)</li>
<li>Notify me that all tests have been completed.</li>
</ol>
<p>Aside from testing the relative performance of each opcode cacher, I also wanted to see how well they performaned under differnt levels of &#8220;stress&#8221;, which is why I included Step 4 with different levels of concurrency. After each test-run, I would switch out the opcode cacher in PHP.ini, making sure that the individual opcode cacher settings were &#8220;equal&#8221; in all ways possible (same amount of shared memory, etc etc). After all test-runs were completed I went through the test files that were generated and compared the results in various graphs.</p>
<p>To form a baseline, I also ran the test with no opcode cacher, in both TS (PHP as a module) and NTS (PHP through FastCGI) setups.</p>
<h2>Results</h2>
<p>The results were extremley eye-opening for me. Here is the pretty graph:</p>
<p><img class="alignnone size-full wp-image-152" title="opcode-cacher-graph" src="http://www.nexdot.net/blog/wp-content/uploads/2010/02/opcode-cacher-graph.jpg" alt="" width="583" height="484" /></p>
<p>Let&#8217;s disect this graph a little bit.</p>
<ul>
<li>Not using an OpCode cacher, if able to, is stupid. The performance gain from using ANY of the available OpCode cachers is amazing. For that matter, any form of caching;<strong> If you aren&#8217;t caching ANYTHING, <span style="text-decoration: underline;">you are stupid</span>.</strong></li>
<li>Non-Thread Safe (NTS, FastCGI) PHP performs better than Thread Safe (TS, Module) PHP. Duh.</li>
<li>WinCache works in Apache. This one is obvious from the graph &amp; my tests, but if you were to go read documentation for WinCache it strictly talks about IIS. This is great news for Apache on Windows, because WinCache is made specifically for windows &#8211; unlike the other OpCode cachers which are usually made with Linux in mind and ported to Windows as an afterthought.</li>
<li>XCache&#8217;s performance increased as the &#8220;stress&#8221; increased. All other opcode cachers either performed the same accross the board or decreased in performance as the &#8220;stress&#8221; level increased. It would be interesting to run larger concurrency tests to see where XCache&#8217;s performance falls off at.</li>
<li>WinCache came out as the top performing opcode cacher, on this setup, in this environment, during these tests.</li>
<li>XCache and APC performed exactly opposite of each other as the &#8220;stress&#8221; increased. eAccelerator was practically the &#8220;best fit line&#8221; for XCache and APC, but it did performed slightly better when averaged across concurrency levels.</li>
<li>APC performed almost as well as WinCache at the lowest (none) concurrency level.</li>
</ul>
<h2>What does this all mean?</h2>
<p>It means that in my tests, on Windows, in Apache, using bleeding edge software, I have shown that WinCache is a viable option for Windows development and production servers. I have not shown that WinCache is THE BEST option or the ONLY option; just that <em>is</em> an option &#8212; regardless of what my graphs show. Why? Because <a href="http://www.ibuildings.co.uk/blog/archives/1566-The-Problem-With-Benchmarks.html" target="_blank">benchmarks suck</a> and they only exist to show a relative level of performance as compared to others in an isolated environment. You may have different results. You may need additional features. You may have political/fanboi issues with using one or the other. Will I be using WinCache going forward? Yes, and I will also recommend it to others.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nexdot.net/blog/2010/02/09/wincache-apache-and-a-pretty-graph/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
