<?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>Ryan McKern &#187; linux</title>
	<atom:link href="http://ryanmckern.com/category/technical/linux-technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://ryanmckern.com</link>
	<description>Loudmouth web engineer from the Boston area; loud music, vitriol, good food.</description>
	<lastBuildDate>Sat, 14 Jan 2012 18:49:43 +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>Apache Admin Notes: Raw Performance Numbers</title>
		<link>http://ryanmckern.com/2009/01/apache-admin-notes-raw-performance-numbers/</link>
		<comments>http://ryanmckern.com/2009/01/apache-admin-notes-raw-performance-numbers/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 21:55:07 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[site meta]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://ryanmckern.com/?p=336</guid>
		<description><![CDATA[Posted in apachelinuxsite metaIn late December I started looking at alternative web servers, having hit a point where I actually asked aloud (though to no one in particular) why I still use Apache for any http or php needs that may arise. I sat down, installed nginx (nginx 0.6.33) from the EPEL (Extra Packages for Enterprise Linux) repositories [...]]]></description>
			<content:encoded><![CDATA[<p>In late December <a href="http://ryanmckern.com/general/280/" >I started looking at alternative web servers</a>, having hit a point where I actually asked aloud (though to no one in particular) why I still use Apache for any http or php needs that may arise.</p>

<p>I sat down, installed <a href="http://nginx.net/" class="aga aga_6">nginx</a> (nginx 0.6.33) from the <a href="https://fedoraproject.org/wiki/EPEL" class="aga aga_7">EPEL (Extra Packages for Enterprise Linux)</a> repositories and <a href="http://www.lighttpd.net/" class="aga aga_8">lighttpd</a> (lighttpd 1.4.20) from the <a href="https://rpmrepo.org/RPMforge" class="aga aga_9">RPMforge</a> repositories (both third party repositories worth writing about in detail at a later date). Apache was already installed (httpd 2.2.3), so a virtualhost was configured to serve data from the same docroot using all three servers, and PHP through fastcgi was configured for lighttpd and nginx<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>.</p>

<p>I then set up a stock WordPress 2.7 blog, some large images, some thumbnails, and created what amount to approximately a 20k index page with nothing cached. Using ApacheBench to fetch 1000 requests, 100 requests at a time, I came up with some simple numbers showing how long it took to return the same page for each web server.</p>

<p>While I openly admit that the benchmarks produced here are arbitrary and superficial, they do give some rough insight (10,000ft overview level insight) as to how much faster nginx and fastcgi are over apache 2.2 and mod_php. lighttpd also performed admirably, and with less hassle involved in set up than nginx, but I suspect that may just be previous familiarity with the configuration.</p>

<p>A table of numbers (soon to be a graph, when I feel like making it) and some thoughts as to what they mean and why we (the web hosting community) still use Apache religiously follows after the jump.</p>

<p><span id="more-336"></span></p>

<table border="0" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <th width="40%">
                Metric
            </th>
            <th width="20%">
                Apache
            </th>
            <th width="20%">
                ligHTTPD
            </th>
            <th width="20%">
                nginx
            </th>
        </tr>
        <tr>
            <td>
                <h5>Time taken for tests</h5>
                lower is better
            </td>
            <td>
                45.584 seconds
            </td>
            <td>
                24.199 seconds
            </td>
            <td>
                17.395 seconds
            </td>
        </tr>
        <tr>
            <td>
                <h5>Total transferred</h5>    
                compression was enabled
            </td>
            <td>
                21691000 bytes
            </td>
            <td>
                22059912 bytes
            </td>
            <td>
                21894000 bytes
            </td>
        </tr>
        <tr>
            <td>
                <h5>HTML transferred</h5>
                compression was enabled
            </td>
            <td>
                21464000 bytes
            </td>
            <td>
                21833686 bytes
            </td>
            <td>
                21671000 bytes
            </td>
        </tr>
        <tr>
            <td>
                <h5>Mean Requests per second</h5>    
                higher is better
            </td>
            <td>
                21.94 [#/sec]
            </td>
            <td>
                41.32 [#/sec]
            </td>
            <td>
                57.49 [#/sec]
            </td>
        </tr>
        <tr>
            <td>
                <h5>Mean Time per request</h5>    
                lower is better
            </td>
            <td>
                4558.396 [ms]
            </td>
            <td>
                2419.853 [ms]
            </td>
            <td>
                1739.542 [ms]
            </td>
        </tr>
        <tr>
            <td>
                <h5>Mean Time per request</h5>
                lower is better
            </td>
            <td>
                45.584 [ms]
            </td>
            <td>
                24.199 [ms]
            </td>
            <td>
                17.395 [ms]
            </td>
        </tr>
        <tr>
            <td>
                <h5>Transfer rate</h5>
                higher is better
            </td>
            <td>
                464.69 [Kbytes/sec]
            </td>
            <td>
                890.26 [Kbytes/sec]
            </td>
            <td>
                1229.11 [Kbytes/sec]
            </td>
        </tr>
    </tbody>
</table>

<p>So what does all this mean? Well, the gist of it is that nginx is really, really god damned fast.
Embarrassingly fast. Note that I didn't say that Apache is slow. It's just not nearly as fast as nginx.
However, that being said, nginx is also not nearly as extensible as Apache is. The lack of support for things that are taken for granted nowadays (.htaccess files come to mind) can be a sticking point for use in a shared hosting environment. lighttpd doesn't support most of those "expected" bells and whistles either, and an argument could be made for such things being a waste of cycles…
But the bottom line is that such bells and whistles are <strong><em>expected</em></strong> to work in a shared hosting environment.</p>

<p>As for why the web hosting community at large drops Apache into place whenever we need an http server, I think it boils down to comfort and laziness. It's bundled with most linux distros by default, we know it because it's been around forever, and its behavior is predictable and familiar. It's become the Microsoft Office of http serving, for better or for worse, and it's not going anywhere any time soon. Even the 800lb gorilla behemoth that is Microsoft IIS has failed to dethrone Apache for sheer ubiquity. I think the performance or security conscious are always going to migrate towards something with better speed and less attack vectors, but the typical admin probably just won't care.</p>

<p>And me? For now I'm going to continue using Apache, while I work out if using nginx for any of the sites I host for people would be a problem. If I can get the rewrite rules taken care of, and work out simple site provisioning, I might well make the switch. nginx seems like a no-brainer on single site virtual servers, where resources are scarce, and Apache isn't getting any more svelte these days.</p>

<p>--</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>Credit where credit is due. I couldn't have started to work out the nginx fastcgi configuration without help from <a href="http://blog.codefront.net/2007/06/11/nginx-php-and-a-php-fastcgi-daemon-init-script/" class="aga aga_10">this post</a> on <a href="http://blog.codefront.net/" class="aga aga_11">redemption in a blog</a>. <a href="#fnref:1" rev="footnote">↩</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ryanmckern.com/2009/01/apache-admin-notes-raw-performance-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 29/44 queries in 0.021 seconds using disk: basic
Object Caching 860/879 objects using disk: basic

Served from: ryanmckern.com @ 2012-02-08 21:13:25 -->
