<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Stephen Foskett, Pack Rat &#187; PAM Archives  &#8211; Stephen Foskett, Pack Rat</title>
	<atom:link href="http://blog.fosketts.net/tag/pam/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fosketts.net</link>
	<description>Understanding the accumulation of data</description>
	<lastBuildDate>Fri, 10 Feb 2012 17:40:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
			<item>
		<title>Tuning Lighttpd For Linux</title>
		<link>http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/</link>
		<comments>http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 15:17:41 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PAM]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Pingdom]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://blog.fosketts.net/?p=2126</guid>
		<description><![CDATA[As I mentioned on Friday, I&#8217;ve recently built a multi-server web hosting environment around lighttpd, MySQL, and Ubuntu Linux. Ironically, my lighttpd web server slowed to a crawl that very evening! It turns out that I had not properly tuned lighttpd to function in a Linux environment. I was surprised to find that the Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned on Friday, I&#8217;ve recently built a <a href="http://blog.fosketts.net/2009/06/26/multiserver-web-host-environment/"  target="_blank">multi-server web hosting environment around lighttpd, MySQL, and Ubuntu Linux</a>. Ironically, my lighttpd web server slowed to a crawl that very evening! It turns out that I had not properly tuned lighttpd to function in a Linux environment. I was surprised to find that the Ubuntu package did not include basic Linux settings! I referred to the <a href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:Performance"  target="_blank">lighttpd performance documentation</a> for help.<span id="more-2126"></span></p>
<h3>File Descriptors</h3>
<p>Anyone familiar with its internals will tell you that <strong>everything is a file to a UNIX operating system</strong>. It&#8217;s the philosophy behind the system: Network connections, storage systems, system parameters, and processes all have file interfaces, and each of these pseudo-files needs a unique file descriptor.</p>
<p>What does this mean for lighttpd? Well, every time a visitor accesses a page, lighttpd uses three file descriptors: An IP socket to the client, a fastCGI process socket, and a filehandle for the document accessed. Lighttpd stops accepting new connections when 90% of the available sockets are in use, restarting again when usage has fallen to 80%. With the default setting of 1024 file descriptors, <strong>lighttpd can handle a maximum of 307 connections</strong>. This is a lot. But it is possible to exceed this number under times of high load.</p>
<p>To prevent this from happening, we can double the limit without any trouble. <strong>Simply set &#8220;server.max-fds&#8221; to 2048 in /etc/lighttpd/lighttpd.conf</strong>.</p>
<p>Contrary to much of the advice I found on the Internet, lighttpd spawned by root does not appear to use the &#8220;nofile&#8221; limits set in /etc/security/limits.conf, since these are for PAM and only apply to full interactive logins. There is a system-wide limit that can be set in /etc/sysctl.conf, however. Check your default with &#8220;<strong>cat /proc/sys/fs/file-max</strong>&#8221; and make sure it&#8217;s over 10,000. Mine was set to 12640 so I left that alone.</p>
<h3>HTTP Keep-Alive</h3>
<p>One reason that file descriptors get used up so quickly is HTTP keep-alive. To improve performance, modern web servers keep client connections alive to handle multiple requests instead of building up and tearing down connections for each item in a page. <strong>Keep-alive is tremendously beneficial to performance, but tends to keep unnecessary connections alive, too</strong>. By default, lighttpd allows 16 keep-alive requests per connection, allows idle sessions to remain alive for 5 seconds, and gives reads and writes 1 minute and 6 minutes to complete, respectively.</p>
<p>Although <strong>lighttpd has pretty aggressive defaults</strong> (especially compared to Apache), a period of heavy traffic and a few slow clients could see many unused connections sticking around. The <strong>server.max-keep-alive-idle</strong> setting default of 5 seconds can be reduced to as low as 2, if you assume your clients are reasonably quick about requesting data, but a value of 3 or 4 is probably realistic. You may want to <em>increase</em> the <strong>server.max-keep-alive-requests</strong> value from the default of 16, but you probably don&#8217;t need to. The <strong>server.max-read-idle</strong> and <strong>server.max-write-idle</strong> settings are tempting targets, but these situations are usually fairly rare so let&#8217;s not monkey with them.</p>
<h3>Mechanics: Polling and Sending</h3>
<p>The best bang for your lighttpd buck is to tune the server to use better kernel resources to check for file changes and write data to the network. There are three critical items here, each of which is set to a conservative universal setting by default.</p>
<p>One of the major areas of UNIX development over the last decade was how to handle the tens of thousands of connections experienced by Internet servers. This &#8220;<a href="http://www.kegel.com/c10k.html"  target="_blank">C10K Problem</a>&#8221; is documented in excruciating detail if you&#8217;re interested, but the net of it is that <strong>each version of UNIX has an advanced mechanism to handle I/O events</strong>. Since kernel version 2.6, Linux has sys_epoll, a so-called edge-triggered polling mechanism which scales linearly with the number of connections. But lighttpd runs on many different flavors of UNIX, so it has to default to the older and less-scalable &#8220;level-triggered&#8221; poll system. To remedy this, <strong>set &#8220;server.event-handler&#8221; to &#8220;linux-sysepoll&#8221;</strong>.</p>
<p>Another mechanism that varies widely across UNIX systems is how to actually <strong>read and write data from the disk to the network</strong>. All systems include basic read() and write() calls, which transfer data into and out of system memory. Lighttpd defaults to using these to move data around. But Linux includes a more advanced call, sendfile, which can move data around without copying it into memory. We can enable this by setting <strong>&#8220;server.network-backend&#8221; to &#8220;linux-sendfile&#8221;</strong>, which ought to <a href="http://www.lighttpd.net/2007/2/3/raw-io-performance"  target="_blank">improve performance</a> for larger (multi-megabyte) files without impacting smaller ones.</p>
<p>Lighttpd attempts to improve performance further by caching the output of the UNIX stat() command. It includes a basic (&#8220;simple&#8221;) cache which keeps the result of file system calls in memory for one second. But many Linux distributions include more advanced accelerators: FAM was the original, and a lighter-weight workalike called Gamin is now included by default in Ubuntu&#8217;s lighttpd install. Therefore, we can improve stat calls simply by allowing lighttpd to use Gamin: Set<strong> &#8220;server.stat-cache-engine&#8221; to &#8220;fam&#8221;</strong> and you&#8217;re rolling!</p>
<p>One more useful tweak to consider, although it&#8217;s not included in the official lighttpd performance document, is not updating the &#8220;atime&#8221; parameter on served pages. This is a bit of a religious issue among some UNIX administrators, but I feel safe in saying that since my web server logs all accesses and I&#8217;m not using any kind of hierarchical storage system to store them, <strong>I don&#8217;t care when each php, html, and png file was last accessed</strong>. We can stop writing atime values by mounting the entire filesystem with &#8220;noatime&#8221;, but I like the more granular approach offered by lighttpd: Simply <strong>set &#8220;server.use-noatime&#8221; to &#8220;enable&#8221;</strong> and it won&#8217;t bother keeping this updated for the files it accesses. Everything else will continue as it always has but with reduced disk I/O.</p>
<h3>Summary</h3>
<p>Lighttpd has pretty good default settings, but a few might be tweaked if we need to respond to higher server loads. The more important area of tuning is simply enabling the advanced features of the 2.6.x Linux kernel and Ubuntu system we are using: <strong>Enable sys_epoll, sendfile, and Gamin and disable atime updates</strong>.</p>
<p>I&#8217;ll post more information as I stumble across it. I&#8217;m still learning, but my server performance as improved dramatically: Pingdom tools <a href="http://tools.pingdom.com/?url=http://blog.fosketts.net&amp;treeview=0&amp;column=objectID&amp;order=1&amp;type=0&amp;save=true"  target="_blank">reports</a> that <strong>it used to take upwards of half a minute to load my blog&#8217;s home page and it now loads in under seven seconds</strong>! That&#8217;s progress!</p>
<pre><code># Maximum number of file descriptors, default = 1024
server.max-fds = 2048
# Maximum number of request within a keep-alive session before the server terminates the connection, default = 16
server.max-keep-alive-requests = 16
# Maximum number of seconds until an idling keep-alive connection is dropped, default = 5
server.max-keep-alive-idle = 4
# Maximum number of seconds until a waiting, non keep-alive read times out and closes the connection, default = 60
server.max-read-idle = 60
# Maximum number of seconds until a waiting write call times out and closes the connection, default = 360
server.max-write-idle = 360
# Which event handler to use, default = poll
server.event-handler = "linux-sysepoll"
# How to handle network writes, default = writev
server.network-backend = "linux-sendfile"
# Requires FAM or Gamin to be installed, default = simple
server.stat-cache-engine = "fam"
# Whether to update the atime setting on file access, default = disable
server.use-noatime = "enable"
</code></pre>
<div id="crp_related"><h3>You might also want to read these other posts...</h3><ul><li><a href="http://blog.fosketts.net/2010/07/30/high-performance-memory-apache-php-virtual-private-server/"  rel="bookmark" class="crp_title">A High-Performance, Low-Memory Apache/PHP Virtual Private Server</a></li><li><a href="http://blog.fosketts.net/2009/06/26/multiserver-web-host-environment/"  rel="bookmark" class="crp_title">Setting Up a Multi-Server Web Hosting Environment</a></li><li><a href="http://blog.fosketts.net/2010/08/01/force-apache-redirect-canonical-hostnames-serveralias-friend/"  rel="bookmark" class="crp_title">How To Force Apache To Redirect To Canonical Hostnames, or ServerAlias Is Not Your Friend</a></li><li><a href="http://blog.fosketts.net/2009/02/07/apologies-404s/"  rel="bookmark" class="crp_title">Apologies For The 404s!</a></li><li><a href="http://blog.fosketts.net/2010/03/25/robocopy-multi-threaded/"  rel="bookmark" class="crp_title">Robocopy: Better, Faster, Stronger</a></li></ul></div><script src="http://feeds.feedburner.com/~s/sfoskett?i=http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/" type="text/javascript" charset="utf-8"></script><hr />
<p><small>© sfoskett for <a href="http://blog.fosketts.net">Stephen Foskett, Pack Rat</a>, 2009. |
<a href="http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/">Tuning Lighttpd For Linux</a>
<br/>
This post was categorized as <a href="http://blog.fosketts.net/category/everything/personal/" title="View all posts in Personal" rel="category tag">Personal</a>. Each of my categories has its own feed if you'd like to filter out or focus on posts like this.<br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<series:name><![CDATA[Web Hosting]]></series:name>
	</item>
		<item>
		<title>The Difference Between &#8220;Integration&#8221; and &#8220;Frankenstein&#8221;</title>
		<link>http://blog.fosketts.net/2009/02/05/difference-integration-frankenstein/</link>
		<comments>http://blog.fosketts.net/2009/02/05/difference-integration-frankenstein/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 15:46:44 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Enterprise storage]]></category>
		<category><![CDATA[Gestalt IT]]></category>
		<category><![CDATA[Alex McDonald]]></category>
		<category><![CDATA[Barry Whyte]]></category>
		<category><![CDATA[Celerra]]></category>
		<category><![CDATA[Chuck Hollis]]></category>
		<category><![CDATA[CLARiiON]]></category>
		<category><![CDATA[DMX]]></category>
		<category><![CDATA[EMC]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[NetApp]]></category>
		<category><![CDATA[OEM]]></category>
		<category><![CDATA[PAM]]></category>
		<category><![CDATA[Quantum]]></category>
		<category><![CDATA[RamSan]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[STEC]]></category>
		<category><![CDATA[Storagebod]]></category>
		<category><![CDATA[Storagezilla]]></category>
		<category><![CDATA[Texas Memory Systems]]></category>
		<category><![CDATA[Tim Burton]]></category>
		<category><![CDATA[TMS]]></category>
		<category><![CDATA[V-Series]]></category>
		<category><![CDATA[WAFL]]></category>

		<guid isPermaLink="false">http://blog.fosketts.net/?p=1383</guid>
		<description><![CDATA[When is a solution integrated and when is it a Frankenstein-like mashup of tangled tech? Apparently, that line is crossed when it&#8217;s your competitor&#8217;s offering&#8230; In my time in the storage industry, I&#8217;ve seen enough franken-storage come and go to make me skeptical whenever a new &#8220;integrated&#8221; solution is announced. But a lot of this [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1384" class="wp-caption alignright" style="width: 151px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: right;"><a href="http://blog.fosketts.net/wp-content/uploads/2009/02/frankenweenie.jpg" ><img class="size-full wp-image-1384" title="frankenweenie" src="http://blog.fosketts.net/wp-content/uploads/2009/02/frankenweenie.jpg" alt="Frankenweenie saves young Victor in Tim Burton's macabre short film" width="141" height="215" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">Frankenweenie saves young Victor in Tim Burton&#39;s macabre short film</p></div>
<p>When is a solution integrated and when is it a Frankenstein-like mashup of tangled tech? Apparently, that line is crossed <strong>when it&#8217;s your competitor&#8217;s offering</strong>&#8230;</p>
<p>In my time in the storage industry, I&#8217;ve seen enough franken-storage come and go to make me skeptical whenever a new &#8220;integrated&#8221; solution is announced. But a lot of this stuff works just fine, so I also know that <strong>integrated solutions aren&#8217;t always bad</strong>!</p>
<p>The latest industry blog flame war centers around <a href="http://www.netapp.com/us/company/news/news-rel-20090203-flash-ssd.html"  target="_blank">NetApp&#8217;s recently-announced solid state storage solution</a>, which pairs a <a href="http://www.netapp.com/us/products/storage-systems/v3100/"  target="_blank">V-Series NAS head</a> and a Texas Memory Systems <a href="http://www.superssd.com/products/ramsan-500/"  target="_blank">RamSan-500</a> flash storage system. Perhaps NetApp&#8217;s <a href="http://blogs.netapp.com/exposed/" >Val Bercovici</a> did get a bit over-excited in <a href="http://blogs.netapp.com/exposed/2009/02/solid-state-sto.html"  target="_blank">his post on the topic</a>, but he wasn&#8217;t just talking about the RamSan: <strong>He was laying out how NetApp&#8217;s WAFL technology can work in an SSD world</strong>, and using some recent performance test numbers on that solution as well as their PAM cache cards as an illustration of this.</p>
<p>The next thing you know, we have EMC&#8217;s <a rel="nofollow" href="http://storagezilla.typepad.com/storagezilla/2009/02/but-wait-theres-less.html"  target="_blank">Storagezilla</a> and IBM&#8217;s <a href="http://www.ibm.com/developerworks/blogs/page/storagevirtualization?entry=did_it_need_a_press"  target="_blank">Barry Whyte</a> calling the company out for what they (and others. like <a rel="nofollow" href="http://storagebod.typepad.com/storagebods_blog/2009/02/is-that-it.html"  target="_blank">Storagebod</a>) see as an underwhelming product offering. That&#8217;s all well and good, and I&#8217;ll let the reader decide if NetApp&#8217;s moves warranted a press release, but now things have gotten <a href="http://blogs.netapp.com/extensible_netapp/"  target="_blank">uglier</a>&#8230;<span id="more-1383"></span></p>
<p>EMC&#8217;s Chuck Hollis called the whole RamSan idea to account, saying it was &#8220;<a href="http://chucksblog.emc.com/chucks_blog/2009/02/whither-frankenstorage.html"  target="_blank">Frankenstorage</a>&#8220;, causing NetApp&#8217;s Alex MacDonald to engage in a little &#8220;<a href="http://blogs.netapp.com/shadeofblue/2009/02/much-of-the-mai.html"  target="_blank">I know you are but what am I</a>&#8221; in reference to EMC&#8217;s CLARiiON/Celerra &#8220;unified storage&#8221; solutions.</p>
<p>It&#8217;s time to<strong> bring some sanity</strong> to this whole integrated solution concept. Every product in the storage world is an amalgamation of OEM parts to one extent or another, and there are always <a rel="nofollow" href="http://stevetodd.typepad.com/my_weblog/2009/02/xam-from-bleeding-to-cutting-edge.html"  target="_blank">integration issues</a>. Certainly many of EMC&#8217;s offerings could be the subject of name-calling: They use <a rel="nofollow" href="http://thestorageanarchist.typepad.com/weblog/2008/09/1025-flash-wars.html"  target="_blank">STEC SSD drives in the DMX</a>, they use <a rel="nofollow" href="http://thebackupblog.typepad.com/thebackupblog/2008/06/not-just-a-river-in-egypt.html"  target="_blank">Quantum deduplication engines</a> in their CDLs, and their Celerra NS platform <em>does</em> include <a rel="nofollow" href="http://chucksblog.typepad.com/chucks_blog/2008/08/emc-unified-sto.html"  target="_blank">a complete Fibre Channel SAN</a> behind the curtain. But they&#8217;re not alone, and not even wrong in doing this: Every vendor relies on OEMs, and as <a rel="nofollow" href="http://storagezilla.typepad.com/storagezilla/2008/11/mr-backup-gets-it-wrong.html"  target="_blank">a wise man said</a>, &#8220;<strong>working with an OEM gives you the flexibility to pick best of breed technologies</strong>&#8221; and that&#8217;s exactly what customers want. Any objective person would welcome qualification and integration of TMS&#8217; RamSan with a solid platform like the NetApp V-Series &#8211; it&#8217;s a certifiable win for the customer. Just like they would be happy to see EMC leveraging great technology from Quantum and STEC.</p>
<p>Chuck goes on to point out some downsides to these OEM combinations, and they&#8217;re certainly fair criticisms:</p>
<ul>
<li>When you&#8217;re buying this from this guy and that from that guy, <strong>it&#8217;s bound to cost more</strong> because <a rel="nofollow" href="http://storagezilla.typepad.com/storagezilla/2009/01/we-dont-do-free-frank.html"  target="_blank">everyone needs their cut</a>.</li>
<li>Since all attempts at unified heterogeneous device management <a rel="nofollow" href="http://storagearchitect.blogspot.com/2009/01/storage-management-aperi-its-all-over.html"  target="_blank">have failed</a>, a combo is certainly <strong>harder to manage</strong> than a single device.</li>
<li>With multiple vendors in the mix, fingerpointing is common once <strong>support is needed</strong>.</li>
</ul>
<p>But these criticisms can be mitigated by the vendors themselves. They can give up some margin in order to gain market share. They can create unified management interfaces for the combinations they sell and support. And they can really support what they sell, refusing to give in to the temptation to say &#8220;not my problem&#8221; when the going gets rough. <strong>And companies deal with these problems all the time</strong>! Frankenstorage doesn&#8217;t have to be so scary&#8230;</p>
<blockquote><p>This post can also be found on <a href="http://gestaltit.com"  target="_blank">Gestalt IT</a>: <a href="http://gestaltit.com/tech/storage/stephen/the-difference-between-%e2%80%9cintegration%e2%80%9d-and-%e2%80%9cfrankenstein%e2%80%9d/" >The Difference Between “Integration” and “Frankenstein”</a></p>
</blockquote>
<div id="crp_related"><h3>You might also want to read these other posts...</h3><ul><li><a href="http://blog.fosketts.net/2009/04/14/emc-symmetrix-vmax-launch/"  rel="bookmark" class="crp_title">Tracking EMC&#8217;s Symmetrix V-Max Launch</a></li><li><a href="http://blog.fosketts.net/2008/03/12/de-duplication-goes-mainstream/"  rel="bookmark" class="crp_title">De-Duplication Goes Mainstream</a></li><li><a href="http://blog.fosketts.net/2008/11/07/emc-maui/"  rel="bookmark" class="crp_title">EMC About To Take Us To Maui&#8230;</a></li><li><a href="http://blog.fosketts.net/2008/12/12/emulated-fibre-channel-virtualization/"  rel="bookmark" class="crp_title">Of Emulated Fibre Channel, Virtualization, And The Right Tool For The Job</a></li><li><a href="http://blog.fosketts.net/2009/01/26/essential-vmware-esx-iscsi/"  rel="bookmark" class="crp_title">Essential Reading for VMware ESX iSCSI Users!</a></li></ul></div><script src="http://feeds.feedburner.com/~s/sfoskett?i=http://blog.fosketts.net/2009/02/05/difference-integration-frankenstein/" type="text/javascript" charset="utf-8"></script><hr />
<p><small>© sfoskett for <a href="http://blog.fosketts.net">Stephen Foskett, Pack Rat</a>, 2009. |
<a href="http://blog.fosketts.net/2009/02/05/difference-integration-frankenstein/">The Difference Between &#8220;Integration&#8221; and &#8220;Frankenstein&#8221;</a>
<br/>
This post was categorized as <a href="http://blog.fosketts.net/category/everything/enterprisestorage/" title="View all posts in Enterprise storage" rel="category tag">Enterprise storage</a>, <a href="http://blog.fosketts.net/category/gestaltit/" title="View all posts in Gestalt IT" rel="category tag">Gestalt IT</a>. Each of my categories has its own feed if you'd like to filter out or focus on posts like this.<br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://blog.fosketts.net/2009/02/05/difference-integration-frankenstein/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

