<?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; nginx</title>
	<atom:link href="http://ryanmckern.com/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://ryanmckern.com</link>
	<description>Linux system administration out of the Boston area; loud music, sharp knives, and a slightly disturbing obsession with food.</description>
	<lastBuildDate>Mon, 19 Jul 2010 21:53:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</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[In 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/">nginx</a> (nginx 0.6.33) from the <a href="https://fedoraproject.org/wiki/EPEL">EPEL (Extra Packages for Enterprise Linux)</a> repositories and <a href="http://www.lighttpd.net/">lighttpd</a> (lighttpd 1.4.20) from the <a href="https://rpmrepo.org/RPMforge">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/">this post</a> on <a href="http://blog.codefront.net/">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>
		<item>
		<title>Apache Admin Notes: Knowing The Field</title>
		<link>http://ryanmckern.com/2008/12/apache-admin-notes-knowin-the-field/</link>
		<comments>http://ryanmckern.com/2008/12/apache-admin-notes-knowin-the-field/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 06:02:13 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[informational]]></category>
		<category><![CDATA[site meta]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[iplanet]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[litespeed]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[shoot-out]]></category>

		<guid isPermaLink="false">http://ryanmckern.com/?p=280</guid>
		<description><![CDATA[For those unaware, I'm an Apache web server administrator. However, for the last few years, a variety of other web servers have been gaining in popularity and building dedicated followings around themselves. 8 years ago when I started Webslum your web server options were basically iPlanet (now Sun Java System Web Server), Apache, and IIS [...]]]></description>
			<content:encoded><![CDATA[<p>For those unaware, I'm an <a href="http://en.wikipedia.org/wiki/Apache_HTTP_Server">Apache</a> web server administrator. However, for the last few years, a variety of other web servers have been gaining in popularity and building dedicated followings around themselves. 8 years ago when I started Webslum your web server options were basically <a href="http://en.wikipedia.org/wiki/IPlanet">iPlanet</a> (now <a href="http://wikis.sun.com/display/WebServer/">Sun Java System Web Server</a>), Apache, and <a href="http://www.iis.net/">IIS</a> (which no one but Windows administrators and suits took seriously then).</p>

<p>However, since then <a href="http://nginx.net/">nginx</a>, <a href="http://www.lighttpd.net/">lighttpd</a>, and <a href="http://litespeedtech.com/products/webserver/overview/">LiteSpeed</a> have all gained various followings due to the things they do better (or don't do at all) over Apache. Apache is sort of a swiss army knife, in that it's infinitely extensible but much like a swiss army knife, it's also not always very good at everything that it does. Ever try to use the swiss army scissors to cut anything more than newsprint? I don't recommend it under the best circumstances. It will end in stitches.</p>

<p>lighttpd in particular has come up as <a href="http://wiki.rubyonrails.org/rails/pages/Lighttpd">popular with the Rails crowd</a>, though that's being phased out in favor of <a href="http://www.modrails.com/">Phusion Passenger</a> (also known as mod_rails, though mod_rack might be more appropriate any day now).</p>

<p>So, this week I plan to sit down and start with <a href="http://en.wikipedia.org/wiki/Comparison_of_web_servers">this comparison on Wikipedia</a>, and then evaluate both my own needs and the needs of my hosted sites to see if Apache is truly the best fit for my needs. Maybe I'll even go so far as to set up a shoot-out with some benchmarks. But probably not. My laziness is notorious.</p>
]]></content:encoded>
			<wfw:commentRss>http://ryanmckern.com/2008/12/apache-admin-notes-knowin-the-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
