<?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>Nott Wise</title>
	<atom:link href="http://nottwise.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://nottwise.co.uk</link>
	<description>PHP Web Development in Nottingham</description>
	<lastBuildDate>Wed, 17 Mar 2010 11:29:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Dabr migration and Apache</title>
		<link>http://nottwise.co.uk/2010/03/dabr-migration-and-apache/</link>
		<comments>http://nottwise.co.uk/2010/03/dabr-migration-and-apache/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 09:18:47 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Dabr]]></category>

		<guid isPermaLink="false">http://nottwise.co.uk/?p=6</guid>
		<description><![CDATA[After a recent purchase of VPS hosting from WebFusion, I wanted to move my high-traffic site dabr.co.uk onto it. With the site exceeding one million daily page views, I really had to be careful about how I&#8217;d move the site to it&#8217;s new home. 10% Using the &#8220;Hostnames&#8221; report within Google Analytics, I was able [...]]]></description>
			<content:encoded><![CDATA[<p>After a recent purchase of <abbr title="Virtual Private Server">VPS</abbr> hosting from WebFusion, I wanted to move my high-traffic site <a title="Dabr, mobile Twitter" href="http://dabr.co.uk">dabr.co.uk</a> onto it. With the site exceeding one million daily page views, I really had to be careful about how I&#8217;d move the site to it&#8217;s new home.</p>
<p><strong>10%</strong></p>
<p>Using the &#8220;Hostnames&#8221; report within Google Analytics, I was able to identify that 10% of users access the site via the <em>m</em> subdomain and 40% use <em>www</em> &#8211; the rest not using any subdomain at all. This was a real stroke of luck as it allowed me to test the new server with a controllable percentage of the total traffic, simply by updating the DNS records.</p>
<p><img class="aligncenter" title="Dabr hostname usage split in February" src="http://farm3.static.flickr.com/2727/4439774407_c8410efcd1_o.png" alt="" width="386" height="231" /></p>
<p>When given 10% load the VPS handled just fine, so after two days I moved on and tried it with 50%.</p>
<p><strong>50%</strong></p>
<p>A second report from Google Analytics also helped tremendously: hourly visits. With about 45% of hits coming from Indonesia (<a title="Dabr usage in Indonesia" href="http://blog.dabr.co.uk/dabr-in-indonesia">yes, really</a>), I needed to know what time was the best window to try any drastic changes to the servers. The graph clearly shows that the longest quiet period I get is between 6pm and 9pm GMT &#8211; when most of Indonesia is asleep and web traffic drops in half:</p>
<p><img title="Dabr visits by hour of day" src="http://farm5.static.flickr.com/4034/4439774385_9e05e4b5b9_o.png" alt="" width="608" height="123" /></p>
<p>On the first few occasions that I did try 50% of the load pointing at the new server &#8211; it buckled and almost completely fell over. A chat with Nick, a friend from <a href="http://heavysumo.com">Heavy Sumo</a>, led me to explore the Apache configuration &#8211; and what a bizarre experience that was.</p>
<p>Here&#8217;s the settings that were used by default on the server, compared with the Apache defaults and the settings on the old server:</p>
<table border="1">
<thead>
<th>Setting</th>
<th>WebFusion VPS</th>
<th>Apache default</th>
<th>Old server</th>
</thead>
<tbody>
<tr>
<td>StartServers</td>
<td>1</td>
<td>5</td>
<td>8</td>
</tr>
<tr>
<td>MinSpareServers</td>
<td>1</td>
<td>5</td>
<td>5</td>
</tr>
<tr>
<td>MaxSpareServers</td>
<td>5</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>MaxClients</td>
<td>10</td>
<td>256</td>
<td>256</td>
</tr>
<tr>
<td>MaxRequestsPerChild</td>
<td>0</td>
<td>1000</td>
<td>4000</td>
</tr>
</tbody>
</table>
<p>Notice the difference?</p>
<p>I have no idea why WebFusion would have their defaults so low. Changing these to match the settings of the old server had a significant boost on performance.</p>
<p>I left 50% traffic on the new server for a couple of weeks, and tried a couple of times to add a bit more, but users quickly complained about the site slowing down.  The slow down matched up to the Indonesian peak time around 2pm GMT, so I rolled back the DNS to point to the old server again.</p>
<p><strong>90%</strong></p>
<p>This stage required a little further exploration of Apache performance tuning articles. One interesting fact I discovered was that Apache has a hard-coded MaxClients limit of 256, which you can only raise by recompiling Apache &#8211; so that wasn&#8217;t particularly an ideal option.</p>
<p>The <a href="http://www.devside.net/articles/apache-performance-tuning">Apache Performance Tuning</a> article from devside.net was the answer to my problems. It suggested a number of different solutions, two of which were to adjust Keep Alive and Timeout settings.</p>
<table border="1">
<thead>
<th>Setting</th>
<th>Webfusion VPS</th>
<th>Devside</th>
</thead>
<tbody>
<tr>
<td>Timeout</td>
<td>300</td>
<td>45</td>
</tr>
<tr>
<td>MaxKeepAliveRequests</td>
<td>100</td>
<td>80</td>
</tr>
<tr>
<td>KeepAliveTimeout</td>
<td>15</td>
<td>2</td>
</tr>
</tbody>
</table>
<p>These changes, combined with the forking settings above, have made the server run<em> much</em> more smoothly. In fact, it&#8217;s now taking 100% of the traffic and people are noticing an <em>improvement</em> in speed.</p>
<p><strong>100%</strong></p>
<p>With the new server running well for a month, I then asked the previous host to delete the old server. Hopefully the new server should last a while before I need to consider load balancing to a second server.</p>
]]></content:encoded>
			<wfw:commentRss>http://nottwise.co.uk/2010/03/dabr-migration-and-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

