<?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>Saiweb &#187; Hosting</title>
	<atom:link href="http://www.saiweb.co.uk/category/hosting/feed" rel="self" type="application/rss+xml" />
	<link>http://www.saiweb.co.uk</link>
	<description>Ramblings of a Sys admin</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:57:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Boxgrinder &#8211; setting up a simple CentOS LAMP stack, and deploying it to KVM</title>
		<link>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm</link>
		<comments>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm#comments</comments>
		<pubDate>Tue, 16 Aug 2011 11:35:54 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[boxgrinder]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[SaaS]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1054</guid>
		<description><![CDATA[If you haven&#8217;t tried boxgrinder then you are missing out, it makes it extremely easy to script the generation of a virtual machine for output to Rackspace (Well not yet), ec2, vmware, virtualbox, KVM etc. In this post I will cover the basic generation of a LAMP (Linux Apache MySQL PHP) stack CentOS appliance, nothing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/boxgrinder_logo_450px.gif"><img class="aligncenter size-full wp-image-1093" title="boxgrinder_logo_450px" src="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/boxgrinder_logo_450px.gif" alt="" width="450" height="110" /></a> If you haven&#8217;t tried <a href="http://boxgrinder.org">boxgrinder</a> then you are missing out, it makes it extremely easy to script the generation of a virtual machine for output to Rackspace (<a href="http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm/comment-page-1#comment-49065">Well not yet</a>), ec2, vmware, virtualbox, KVM etc.</p>
<p>In this post I will cover the basic generation of a LAMP (Linux Apache MySQL PHP) stack CentOS appliance, nothing to complicated I assure you, and no magic like auto deployment spin up etc &#8230; that&#8217;s for later &#8230; no skipping ahead!</p>
<p>First of all you&#8217;re going to need <a href="http://boxgrinder.org">boxgrinder</a> I recommend downloading the <a href="http://boxgrinder.org/download/boxgrinder-build-meta-appliance/">Meta appliance</a>, as it has all the tools you need already.</p>
<p>Now I am covering the following.</p>
<ol>
<li>basic use of boxgrinder-build on the meta appliance</li>
<li>creation of centos lampstack basic</li>
<li>deploying the image to KVM</li>
</ol>
<p>I&#8217;m going to have to assume that you are capable of downloading and starting up the meta appliance yourself, and focus more on the stack setup.</p>
<p><strong>Grinding your VM</strong></p>
<p>Ok so you are going to need a YAML file defining the CentOS lamp stack, save this on your meta appliance as <a href="https://github.com/Oneiroi/boxgrinder-appliances/blob/master/CentOS/CentOS-lamp.appl">CentOS-lamp.yaml</a></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">name: CentOS-lamp<br />
summary: Generic CentOS 5.6 LAMP stack, with some apache &amp;amp; php tuning<br />
version: 1<br />
release: 0<br />
hardware:<br />
cpus: 2<br />
memory: 1024<br />
partitions:<br />
&quot;/&quot;:<br />
size: 5<br />
&quot;/var/www&quot;:<br />
size: 15<br />
os:<br />
name: centos<br />
version: 5<br />
password: changeme</div></td></tr></tbody></table></div>
<p>On your <a href="http://boxgrinder.org/download/boxgrinder-build-meta-appliance/">Meta appliance</a> run.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">boxgrinder-build -d CentOS-lamp.appl</div></td></tr></tbody></table></div>
<p>This process will take a while, so go and get a coffee, this will produce ./build/appliances/x86_64/centos/5/CentOS-lamp/CentOS-lamp-sda.raw once complete, if you run into issues the -d flag is &#8220;debug&#8221; paste your log output int the comments and I will do my best to diagnose and fix your issue.</p>
<p><strong>Deploying to KVM</strong></p>
<p>boxgrinder has SFTP support for pushing to remote servers, you can use this if you like to automate the &#8220;push&#8221; of the image to your KVM server, at the moment automated deployment to KVM is not support but may be <a href="https://issues.jboss.org/browse/BGBUILD-211">coming soon</a>.</p>
<p>Assuming you have placed you image in /var/lib/libvirt/images/</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">virt-install -n &quot;Saiweb - CentOS-lamp Demo&quot; -r 1024 --arch=x86_64 --vcpus=1 --os-type=linux --os-variant=rhel5.4 --disk path=/var/lib/libvirt/images/CentOS-lamp.raw,size=20,cache=none,device=disk --accelerate --network=bridge:br0 --vnc --import</div></td></tr></tbody></table></div>
<p><strong>Post startup</strong></p>
<p>this is a VERY basic setup I have not covered any of the post install options in this post (but I will in future posts), so.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chkconfig httpd on &amp;amp;&amp;amp; service httpd start<br />
chkconfig mysqld on &amp;amp;&amp;amp; service mysqld start</div></td></tr></tbody></table></div>
<p>This will set your services to automatically start at startup, and start them.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm" data-text="Boxgrinder &#8211; setting up a simple CentOS LAMP stack, and deploying it to KVM" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fboxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm&#038;text=Boxgrinder%20%26%238211%3B%20setting%20up%20a%20simple%20CentOS%20LAMP%20stack%2C%20and%20deploying%20it%20to%20KVM" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/boxgrinder-setting-up-a-simple-centos-lamp-stack-and-deploying-it-to-kvm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Content purging changes in Varnish 3.0</title>
		<link>http://www.saiweb.co.uk/linux/content-purging-changes-in-varnish-3-0</link>
		<comments>http://www.saiweb.co.uk/linux/content-purging-changes-in-varnish-3-0#comments</comments>
		<pubDate>Fri, 12 Aug 2011 08:25:45 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[2.x]]></category>
		<category><![CDATA[3.x]]></category>
		<category><![CDATA[changes]]></category>
		<category><![CDATA[PURGE]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1085</guid>
		<description><![CDATA[If you tie in your web application to automatically PURGE content when you modify it, thus keeping the content &#8220;fresh&#8221; while using Varnish you may notice if you made the jump from 2.x to 3.x that your PURGE VCL is no longer working, I refer you to: https://www.varnish-software.com/blog/bans-and-purges-varnish-30 In short replace your usual 1234567891011sub vcl_hit [...]]]></description>
			<content:encoded><![CDATA[<p>If you tie in your web application to automatically PURGE content when you modify it, thus keeping the content &#8220;fresh&#8221; while using Varnish you may notice if you made the jump from 2.x to 3.x that your PURGE VCL is no longer working, I refer you to: <a href="https://www.varnish-software.com/blog/bans-and-purges-varnish-30">https://www.varnish-software.com/blog/bans-and-purges-varnish-30</a></p>
<p>In short replace your usual</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sub vcl_hit {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (req.request == &quot;PURGE&quot;) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set obj.ttl = 0s;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error 200 &quot;Purged.&quot;; #uses error function to return simple confirmation<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
sub vcl_miss {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (req.request == &quot;PURGE&quot;) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error 404 &quot;Not in cache.&quot;; #request to purge none existant item<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</div></td></tr></tbody></table></div>
<p>with</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sub vcl_recv {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (req.request == &quot;PURGE&quot;) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!client.ip ~ purge) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error 405 &quot;Not allowed.&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ban(&quot;req.url ~ &quot;+req.url+&quot; &amp;&amp; req.http.host == &quot;+req.http.host);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error 200 &quot;Purged.&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
...</div></td></tr></tbody></table></div>
<p>Substituting &#8220;~ purge&#8221; with your ACL name, the above implement wild card purging aswell, if you do not want this and only want PURGE for the exact passed URL replace </p>
<p>&#8220;req.url ~ &#8220;+req.url</p>
<p>with</p>
<p>&#8220;req.url == &#8220;+req.url</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/content-purging-changes-in-varnish-3-0" data-text="Content purging changes in Varnish 3.0" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fcontent-purging-changes-in-varnish-3-0&#038;text=Content%20purging%20changes%20in%20Varnish%203.0" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/content-purging-changes-in-varnish-3-0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &amp; Caching an in depth review &#8211; Follow up using Varnish</title>
		<link>http://www.saiweb.co.uk/php/php-caching-an-in-depth-review-follow-up-using-varnish</link>
		<comments>http://www.saiweb.co.uk/php/php-caching-an-in-depth-review-follow-up-using-varnish#comments</comments>
		<pubDate>Wed, 10 Aug 2011 20:59:26 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1069</guid>
		<description><![CDATA[Ok, so following up on PHP &#038; Caching with Varnish, let&#8217;s cut to the hard facts shall we? Using the same tests as ab -c 100 -n 500 -g ./saiweb-nocache-nogzip.bpl http://www.saiweb.co.uk/ This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.saiweb.co.uk (be patient) [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so following up on PHP &#038; Caching with Varnish, let&#8217;s cut to the hard facts shall we?</p>
<p>Using the same tests as <a href="http://www.saiweb.co.uk/hosting/php-caching-an-in-depth-review" title="PHP &#038; Caching an in depth review"></a></p>
<p> ab -c 100 -n 500 -g ./saiweb-nocache-nogzip.bpl http://www.saiweb.co.uk/<br />
This is ApacheBench, Version 2.3 <$Revision: 655654 $><br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/</p>
<p>Benchmarking www.saiweb.co.uk (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Finished 500 requests</p>
<p>Server Software:        Apache<br />
Server Hostname:        www.saiweb.co.uk<br />
Server Port:            80</p>
<p>Document Path:          /<br />
Document Length:        92719 bytes</p>
<p>Concurrency Level:      100<br />
Time taken for tests:   0.184 seconds<br />
Complete requests:      500<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      47597095 bytes<br />
HTML transferred:       47379409 bytes<br />
Requests per second:    2716.92 [#/sec] (mean)<br />
Time per request:       36.806 [ms] (mean)<br />
Time per request:       0.368 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          252573.13 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
              min  mean[+/-sd] median   max<br />
Connect:        1    4   1.1      4       6<br />
Processing:     9   31   7.0     32      47<br />
Waiting:        2    7   5.7      4      26<br />
Total:         15   35   6.8     36      53</p>
<p>Percentage of the requests served within a certain time (ms)<br />
  50%     36<br />
  66%     38<br />
  75%     39<br />
  80%     39<br />
  90%     41<br />
  95%     44<br />
  98%     48<br />
  99%     51<br />
 100%     53 (longest request)</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/Out.png"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2011/08/Out.png" alt="ab -c 100 -n 500 -g ./saiweb-nocache-nogzip.bpl http://www.saiweb.co.uk/" title="ab -c 100 -n 500 -g ./saiweb-nocache-nogzip.bpl http://www.saiweb.co.uk/" width="640" height="480" class="aligncenter size-full wp-image-1070" /></a></p>
<p>2716.92 requests per second with a server load average of 0.1, and in this case varnish is serving cache from disk.</p>
<p>Caching using varnish (Or even nginx / mod_cache) means that PHP does not get executed at all, the cache system grabs the cache content and serves it.</p>
<p>This of course has the benefit of reducing the CPU and memory resources needed for the running of your application, but it does have some caveats.</p>
<ul>
<li>This only works for GET requests, and content not reliant on Cookies (Truely dynamic content will not cache)</li>
<li>But on the &#8220;flipside&#8221; Varnish supports ESI, which when setup correctly you can target the dynamic sections of a pag for &#8220;passthrough&#8221; and have the rest cached</li>
<ol>
<p>More details to come, as I have time to add them I have have a lot of posts to make on boxgrinder, KVM, libvirtd etc.<br />
<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/php/php-caching-an-in-depth-review-follow-up-using-varnish" data-text="PHP &#038; Caching an in depth review &#8211; Follow up using Varnish" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fphp%2Fphp-caching-an-in-depth-review-follow-up-using-varnish&#038;text=PHP%20%26%23038%3B%20Caching%20an%20in%20depth%20review%20%26%238211%3B%20Follow%20up%20using%20Varnish" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/php/php-caching-an-in-depth-review-follow-up-using-varnish/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make your webapp shine with varnish – Part 2 backends</title>
		<link>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-%e2%80%93-part-2-backends</link>
		<comments>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-%e2%80%93-part-2-backends#comments</comments>
		<pubDate>Sat, 18 Jun 2011 12:09:39 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[high]]></category>
		<category><![CDATA[performance.]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1039</guid>
		<description><![CDATA[Pre-req reading: Part 1 In this part we will cover setting up a backend. A backend is your application server, whether this be apache / nginx / iis (IIS &#8211; Is Inherently Stupid) you are telling varnish where it should sends it&#8217;s requests to. Very basic configuration 1234.backend app1 { &#160; &#160; .host = &#34;127.0.0.1&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>Pre-req reading: <a href="http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-part-1">Part 1</a></p>
<p>In this part we will cover setting up a backend. A backend is your application server, whether this be apache / nginx / iis (IIS &#8211; <strong>I</strong>s <strong>I</strong>nherently <strong>S</strong>tupid) you are telling varnish where it should sends it&#8217;s requests to.<br />
<strong><br />
Very basic configuration</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.backend app1 {<br />
&nbsp; &nbsp; .host = &quot;127.0.0.1&quot;;<br />
&nbsp; &nbsp; .port = &quot;8080;&quot;<br />
}</div></td></tr></tbody></table></div>
<p>For a quick start that&#8217;s it really you tell varnish a backend and the port to connect to it on &#8230; just make sure you use it in vcl_recv, but you&#8217;re not here for simple and quick start are you? lets add the following.</p>
<ul>
<li>timeout settings</li>
<li>probe settings</li>
</ul>
<p><strong>Timeout settings</strong></p>
<p>Your timeout settings deinf how long varnish should wait for a response from your backend</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.backend app1 {<br />
&nbsp; &nbsp; .host = &quot;127.0.0.1&quot;;<br />
&nbsp; &nbsp; .port = &quot;8080;&quot;<br />
&nbsp; &nbsp; .connect_timeout = 0.05s;<br />
&nbsp; &nbsp; .first_byte_timeout = 2s;<br />
&nbsp; &nbsp; .between_bytes_timeout = 2s;<br />
}</div></td></tr></tbody></table></div>
<ul>
<li><strong>connect_timeout</strong> wait 50ms for a tcp connection to take place</li>
<li><strong>first_byte_timeout</strong> wait 2s for the first byte of data to be sent from the backend</li>
<li><strong>between_bytes_timeout</strong> wait 2s if there is a pause mid data stream</li>
</ul>
<p>Timeouts are a basic way of determining if a backend is down / miss behaving if you have multiple backends if timeouts occur then the backend is marked as sick and the other backends will be used.</p>
<p><strong>probe settings &#8211; Trust me I&#8217;m a doctor</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.backend app1 {<br />
&nbsp; &nbsp; .host = &quot;127.0.0.1&quot;;<br />
&nbsp; &nbsp; .port = &quot;8080;&quot;<br />
&nbsp; &nbsp; .connect_timeout = 0.05s;<br />
&nbsp; &nbsp; .first_byte_timeout = 2s;<br />
&nbsp; &nbsp; .between_bytes_timeout = 2s;<br />
&nbsp; &nbsp; .probe = {<br />
&nbsp; &nbsp; .url = &quot;/status.html&quot;;<br />
&nbsp; &nbsp; .timeout = 0.05s;<br />
&nbsp; &nbsp; .window = 5;&nbsp; &nbsp; <br />
&nbsp; &nbsp; .threshold = 3; #60% of last checks must of been OK for this backend to be healthy<br />
&nbsp; &nbsp; .interval = 2s; #how often to run the checks<br />
&nbsp; &nbsp; }<br />
}</div></td></tr></tbody></table></div>
<ul>
<li><strong>url</strong> the URL to to query this must return a 200 OK response, you could use a php script to return a 500 on say a mySQL outage</li>
<li><strong>timeout</strong> how long to wait for a 200 OK response from the URL</li>
<li><strong>window</strong> keep the result of the last 5 probes in memory</li>
<li><strong>threshold</strong> how many of the window total must be OK for the backend to be &#8220;healthy&#8221;</li>
<li><strong>interval</strong> how often to run the probe</li>
</ul>
<p>And that about wraps up this post.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-%e2%80%93-part-2-backends" data-text="Make your webapp shine with varnish – Part 2 backends" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fmake-your-webapp-shine-with-varnish-%25e2%2580%2593-part-2-backends&#038;text=Make%20your%20webapp%20shine%20with%20varnish%20%E2%80%93%20Part%202%20backends" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-%e2%80%93-part-2-backends/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make your webapp shine with varnish &#8211; Part 1</title>
		<link>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-part-1</link>
		<comments>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-part-1#comments</comments>
		<pubDate>Tue, 12 Oct 2010 12:56:55 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[high]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[performance.]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=957</guid>
		<description><![CDATA[Part 1, what is varnish? The varnish cache project is one you really need to get familiar with if you manage any high volume websites, it can mean the difference between a self destructing web app that buckles under it&#8217;s own load, and an apparently seamless web app serving 1000&#8242;s of concurrent connections per second [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Part 1, what is varnish?</strong></p>
<p>The <a href="www.varnish-cache.org">varnish cache project</a> is one you really need to get familiar with if you manage any high volume websites, it can mean the difference between a self destructing web app that buckles under it&#8217;s own load, and an apparently seamless web app serving 1000&#8242;s of concurrent connections per second with relative ease.</p>
<p><strong>How does it work?</strong></p>
<p>Varnish acts as a proxy server, in that when a use sends a GET request varnish will lookup in its internal database for a cached version and if it can not find one it will pass the request to the &#8220;back end&#8221; or in this case an apache server, varnish will then cache the response for subsequent accesses.</p>
<p>Now you may ask yourself why do you need this? this boils down to what you are trying to achieve with your web application, if your application is heavily reliant on dynamic content and regularly gets some 400 concurrent users for example, lets assume the following:</p>
<ol>
<li>400 concurrent unique users</li>
<li>Average page render time is 0.85s</li>
</ol>
<p><strong>The Math</strong></p>
<p>Based on this if you were to place varnish in front of your application with a 60second ttl (time to live, length of time varnish will hold an object in cache):</p>
<ol>
<li>Varnish ttl 60 seconds</li>
<li>400/0.85 = 470.59/second</li>
<li>28235.29/minute</li>
<li>Factor of reduction to &#8220;back end&#8221;: x28235.29</li>
</ol>
<p>So in the example above simply by caching a page for as little as 60 seconds, the requests/minute as reduced from 28235.29 to 1, now even reducing the cache times to 10 seconds in this example would give a x4705.88 reduction.</p>
<p>How is this reduction a good thing, well time on cpu for one, varnish when configured correctly is very very fast, and even with an out of the box configuration it&#8217;s still going to be much faster than your dynamic web application.</p>
<p><strong>Summary</strong></p>
<p>So here ends a brief introduction to varnish and why you realy want to start using it, in the following parts we will cover</p>
<ul>
<li>Configuration overview</li>
<ul>
<li>brief overview of each sub section based on the 2.1 syntax</li>
</ul>
<ul>
<li>Advanced configuration</li>
<ul>
<li>Load balancing</li>
<li>Failover handling</li>
<li>Raising cache hitrate</li>
<li>Pros and cons of each setup</li>
<li>Benchmarks</li>
</ul>
</ul>
</ul>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-part-1" data-text="Make your webapp shine with varnish &#8211; Part 1" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Flinux%2Fmake-your-webapp-shine-with-varnish-part-1&#038;text=Make%20your%20webapp%20shine%20with%20varnish%20%26%238211%3B%20Part%201" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/linux/make-your-webapp-shine-with-varnish-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP &amp; Caching an in depth review.</title>
		<link>http://www.saiweb.co.uk/hosting/php-caching-an-in-depth-review</link>
		<comments>http://www.saiweb.co.uk/hosting/php-caching-an-in-depth-review#comments</comments>
		<pubDate>Thu, 26 Aug 2010 18:11:59 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[faster]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=800</guid>
		<description><![CDATA[Sounds simple enough, right? Use a cache to serve pages faster, well yes that is true but people often do not realize the fundamentals of caching and how if not done properly it can lead to a detriment in performance. The first thing you need to realize that by caching your content is no longer [...]]]></description>
			<content:encoded><![CDATA[<p>Sounds simple enough, right?</p>
<p>Use a cache to serve pages faster, well yes that is true but people often do not realize the fundamentals of caching and how if not done properly it can lead to a detriment in performance.</p>
<p>The first thing you need to realize that by caching your content is no longer dynamic, &#8230; (short pause while we wait for the outrage in the back to die down).</p>
<p>The whole point behind your cache is that it will be used instead of processing all your code, why this is beneficial?</p>
<p>You have to remember that PHP is an interpreted language, meaning it takes the following I/O flow:</p>
<p>Apache -&gt; mod_php -&gt; Script -&gt; Interpreter -&gt; Bytecode -&gt; Execution -&gt; Output Buffer</p>
<p>Now there are two types of caching to consider, the first is completion output caching, this also yields the best performance, the second is opcode caching, this caches the byte code generated by the interpreter thus removing that step from the chain of execution.</p>
<p>With me so far? Ok take a deep breath because here we go &#8230;</p>
<p><strong>Output caching</strong></p>
<p>This option often yields the best performance, but at the cost of removing the dynamic element from your web app.<br />
But this can be summed up in a single line: What good is dynamic content if you can serve all of 5% of your audience at a given time?</p>
<p>Another turn of phrase is &#8220;The slashdot effect&#8221;, there are many options for output caching, and you should ideally provide gziped and plain cache files to your end user,  for instance on this blog I use WP Super Cache, and can high recommend it, as new content is posted the relevant caches are regenerated, if you are writing your own WebApp check for the &#8220;Accept-Encoding:gzip&#8221; header being sent via the users browser.</p>
<p>For end user transparency couple this with some mod_rewrite voodoo</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RewriteCond %{HTTP:Accept-Encoding} gzip<br />
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/%{REQUEST_FILENAME}.gz -f<br />
RewriteRule ^(.*) &quot;/cache/%{HTTP_HOST}/%{REQUEST_FILENAME}.gz&quot; [L]</div></td></tr></tbody></table></div>
<p>1: If gzip is supported<br />
2: and the cache file exists<br />
3: Redirect visitor to compressed cached file</p>
<p>You &#8220;chain of execution&#8221; is now</p>
<p>Apache -&gt; readfile</p>
<p>To serve non gziped content:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RewriteCond %{HTTP:Accept-Encoding} !gzip<br />
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/%{REQUEST_FILENAME} -f<br />
RewriteRule ^(.*) &quot;/cache/%{HTTP_HOST}/%{REQUEST_FILENAME}&quot; [L]</div></td></tr></tbody></table></div>
<p>Now to clarify a point you should not be caching images,css,js etc, we&#8217;re only covering dynamic content here, and the above are only examples to get you started, you should write rules to exclude certain content specific to your needs.</p>
<p>And before going of at any more of a tangent, here are some figures for you!</p>
<p><strong>ab -c 100 -n 500 -g ./saiweb-nocache-nogzip.bpl http://www.saiweb.co.uk/</strong></p>
<ul>
<li>No caching</li>
<li>No Gzip</li>
</ul>
<p>Server Hostname:        www.saiweb.co.uk<br />
Server Port:            80</p>
<p>Document Path:          /<br />
Document Length:        109086 bytes</p>
<p>Concurrency Level:      100<br />
Time taken for tests:   123.304 seconds<br />
Complete requests:      500<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      54831652 bytes<br />
HTML transferred:       54692607 bytes<br />
Requests per second:    4.06 [#/sec] (mean)<br />
Time per request:       24660.828 [ms] (mean)<br />
Time per request:       246.608 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          434.26 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
min  mean[+/-sd] median   max<br />
Connect:       57  423 225.5    374    1837<br />
Processing:  2331 20460 16701.2  17232  115192<br />
Waiting:      270 1835 4155.8    576   38549<br />
Total:       2656 20882 16648.1  17692  115421</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50%  17692<br />
66%  20700<br />
75%  24063<br />
80%  25770<br />
90%  35157<br />
95%  53328<br />
98%  82957<br />
99%  101497<br />
100%  115421 (longest request)</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-nocache-nogzip.png"><img class="aligncenter size-full wp-image-939" title="saiweb-nocache-nogzip" src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-nocache-nogzip.png" alt="" width="640" height="480" /></a></p>
<p>As can be seen as the number of requests grew the response time began to increase sharply and the overall performace of the site degrade, bare in mind these benchmarks are being made on my home DSL for the time being.</p>
<p><strong><br />
ab -c 100 -n 500 -g ./saiweb-cached.bpl http://www.saiweb.co.uk/</strong></p>
<p>Server Hostname:        www.saiweb.co.uk<br />
Server Port:            80</p>
<p>Document Path:          /<br />
Document Length:        109086 bytes</p>
<p>Concurrency Level:      100<br />
Time taken for tests:   79.212 seconds<br />
Complete requests:      500<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      54889292 bytes<br />
HTML transferred:       54705058 bytes<br />
Requests per second:    6.31 [#/sec] (mean)<br />
Time per request:       15842.342 [ms] (mean)<br />
Time per request:       158.423 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          676.70 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
              min  mean[+/-sd] median   max<br />
Connect:       56  314 112.5    322    1341<br />
Processing:  2545 14721 5116.7  14296   36677<br />
Waiting:      216 1283 2228.2    351   13776<br />
Total:       2647 15035 5108.9  14624   36897</p>
<p>Percentage of the requests served within a certain time (ms)<br />
  50%  14624<br />
  66%  16675<br />
  75%  18058<br />
  80%  19093<br />
  90%  21608<br />
  95%  23489<br />
  98%  27684<br />
  99%  29972<br />
 100%  36897 (longest request)</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached1.png"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached1.png" alt="" title="saiweb-cached" width="640" height="480" class="aligncenter size-full wp-image-941" /></a></p>
<p>A much more consistent line here, however as you can clearly see response times are roughly equal this is due to my DSL connection, so lets run these tests from somewhere with a little more bandwidth say the webserver itself using a loop back connection.</p>
<p><strong><br />
ab -c 100 -n 500 -g ./saiweb-cached.bpl http://www.saiweb.co.uk/</strong></p>
<p>Server Hostname:        www.saiweb.co.uk<br />
Server Port:            80</p>
<p>Document Path:          /<br />
Document Length:        109086 bytes</p>
<p>Concurrency Level:      100<br />
Time taken for tests:   0.262199 seconds<br />
Complete requests:      500<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      54945406 bytes<br />
HTML transferred:       54761172 bytes<br />
Requests per second:    1906.95 [#/sec] (mean)<br />
Time per request:       52.440 [ms] (mean)<br />
Time per request:       0.524 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          204642.27 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
              min  mean[+/-sd] median   max<br />
Connect:        0    1   2.6      0       9<br />
Processing:     4   45  10.3     49      58<br />
Waiting:        1   38   9.9     41      50<br />
Total:          9   47   9.5     50      64</p>
<p>Percentage of the requests served within a certain time (ms)<br />
  50%     50<br />
  66%     51<br />
  75%     52<br />
  80%     52<br />
  90%     54<br />
  95%     56<br />
  98%     59<br />
  99%     61<br />
 100%     64 (longest request)</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached21.png"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached21.png" alt="" title="saiweb-cached2" width="640" height="480" class="aligncenter size-full wp-image-943" /></a></p>
<p>In this case the response times rise and then plateau, no after which no further degradation occurs. </p>
<p><strong><br />
ab -c 100 -n 500 -g ./saiweb-nocache.bpl http://www.saiweb.co.uk/</strong></p>
<p>Server Hostname:        www.saiweb.co.uk<br />
Server Port:            80</p>
<p>Document Path:          /<br />
Document Length:        109086 bytes</p>
<p>Concurrency Level:      100<br />
Time taken for tests:   8.919565 seconds<br />
Complete requests:      500<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      54680788 bytes<br />
HTML transferred:       54543000 bytes<br />
Requests per second:    56.06 [#/sec] (mean)<br />
Time per request:       1783.913 [ms] (mean)<br />
Time per request:       17.839 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          5986.73 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
              min  mean[+/-sd] median   max<br />
Connect:        0   14  30.7      0      85<br />
Processing:   246 1556 714.3   1365    6735<br />
Waiting:      241 1539 707.8   1360    6731<br />
Total:        250 1571 708.0   1368    6735</p>
<p>Percentage of the requests served within a certain time (ms)<br />
  50%   1368<br />
  66%   1451<br />
  75%   1550<br />
  80%   1700<br />
  90%   2658<br />
  95%   3121<br />
  98%   3491<br />
  99%   3638<br />
 100%   6735 (longest request)</p>
<p><a href="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached3.png"><img src="http://cdn.saiweb.co.uk/wp-content/uploads/2010/08/saiweb-cached3.png" alt="" title="saiweb-cached3" width="640" height="480" class="aligncenter size-full wp-image-944" /></a></p>
<p>Oh dear of dear lets cut to the hard facts shall we?</p>
<p>We&#8217;ve gone from serving 1906.95 requests a second to 56.06 </p>
<ul>
<li>a 97.1% decrease in performance when removing caching</li>
<li>or a 3401.1% increase in performance when implementing caching</li>
</ul>
<p>We&#8217;ve gone from a response time of ~50ms to ~2000ms</p>
<ul>
<li>a 97.5% decrease in performance when removing caching</li>
<li>or a 4000% increase in performance when caching is on</li>
</ul>
<p>Then there is the CPU an memory overheads to consider, in this case a more prolonged test is required to gain the relevant sar data,<br />
now let me tell you that intentionally trying to get a test like this to run over a 10 minute period with the correct caching on is a lot harder than it sounds, the tests infact were completing far too quickly &#8230; </p>
<p>The problem I face is to make ab perform a long enough timed duration of results cached, I know for a fact uncached the server will fail under the load, so I have no way at present of grabbing this reliably, </p>
<p>what I can tell you is that this command: ab -c 300 -n 1000000 -g ./saiweb-cached.bpl http://www.saiweb.co.uk/</p>
<p>caused a load average of 2.96, 1.9,0.93 cache, and got as high as 21 before I killed it uncached.</p>
<p>Now I am going to bring this post to an end as it is getting quiet long, I plan to cover the following in a 2nd part.</p>
<ol>
<li>Opcode caching</li>
<li>CPU &#038; Memory usage, Cached vs. UNcached</li>
</ol>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/hosting/php-caching-an-in-depth-review" data-text="PHP &#038; Caching an in depth review." href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fhosting%2Fphp-caching-an-in-depth-review&#038;text=PHP%20%26%23038%3B%20Caching%20an%20in%20depth%20review." >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/hosting/php-caching-an-in-depth-review/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloud hosting &#8211; my views</title>
		<link>http://www.saiweb.co.uk/hosting/cloud-hosting-my-views</link>
		<comments>http://www.saiweb.co.uk/hosting/cloud-hosting-my-views#comments</comments>
		<pubDate>Wed, 25 Aug 2010 15:25:05 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[is]]></category>
		<category><![CDATA[pants]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=927</guid>
		<description><![CDATA[This blog entry here: http://rackerhacker.com/2010/08/25/a-nerds-perspective-on-cloud-hosting/ prompted me to write this blog post, after I realized I&#8217;d filled the comment field, without ending my &#8220;monologue&#8221;, anyway I thought it would be better to voice my opinions here, to you lot who are daft enough to read this blog. I think the problem mainly is the term [...]]]></description>
			<content:encoded><![CDATA[<p>This blog entry here: <a href="http://rackerhacker.com/2010/08/25/a-nerds-perspective-on-cloud-hosting/">http://rackerhacker.com/2010/08/25/a-nerds-perspective-on-cloud-hosting/</a> prompted me to write this blog post, after I realized I&#8217;d filled the comment field, without ending my &#8220;monologue&#8221;, anyway I thought it would be better to voice my opinions here, to you lot who are daft enough to read this blog.</p>
<p>I think the problem mainly is the term &#8220;cloud&#8221; has been massively over marketed and possibly long since lost it&#8217;s original meaning, with providers trying to jump on the marketing bandwagon.</p>
<p>I&#8217;ve not made the jump to &#8220;the Cloud&#8221; yet, as frankly I can&#8217;t see a benefit to them over properly configured HA installations, for example I would much rather be using several pre-configured servers using RHCS to handle the migration of critical services (mySQL etc..).</p>
<p>I begin to see the benefits for large hosting providers, where customers what the power of a dedicated server but only pay for what they actually use, in this instance a provider ensures up time through live migration,</p>
<p>Some other misconceptions through over marketing I&#8217;d like to point out,</p>
<p>1) <strong>The &#8220;cloud&#8221; is not always on</strong></p>
<p>Don&#8217;t get me wrong it can be configured to be close, using distributed VM&#8217;s for your critical services (i.e. apache), coupling this with loadbalancing and clustering setups.</p>
<p>The misconception for most &#8220;end users&#8221; is that if you buy a single cloud instance, through magic/voodoo it will always be on 100% of the time!</p>
<p>Simply put if the hardware it was running on dies, it will go down, regardless of live migration measures in place, there will be downtime, do not pass go do not collect http 200 go directly to &gt; /dev/null</p>
<p>2) <strong>The &#8220;cloud&#8221; is not secure</strong></p>
<p>If you insist on putting your 5 year old joomla website on a cloud VM, it can and will become compromised quickly, security is only going to be as good as the configuration you have in place, you have mitigation measures such as</p>
<ul>
<li>selinux</li>
<li>webapp updates/patches</li>
<li>fail2ban/banhosts packages</li>
</ul>
<p>Whilst in itself a VM is largely seen as secure as it protects the host machine should the VM become compromised, it is not always the case, for instance there have been several occurrences of VMWare ESXI servers allowing code execution on the host (long since patched Don&#8217;t panic!), allowing attackers who have compromised a VM on the cloud to root the host machine and as a cascading effect every other VM instace on the box.</p>
<p>Let me point out a worst case scenario here:</p>
<ol>
<li>Hypervisor running on Host A with 30 Vm&#8217;s</li>
<li>Host A is part of a resilient set with live migration in place, Hosts B,C,D</li>
<li>VM A&#8217;s 5 year old joomla app is subject to an XSS bug, and an attacker places the r57 shell on the webapp,</li>
<li>attacker proceeds to deploy backdoors (i.e. meterpreter)</li>
<li>VM A is subject to remote code execution on host</li>
<li>Attacker compromises Host</li>
<li>Host A is now root&#8217;ed</li>
<li>Attacker forces Migration of VM A onto Host B</li>
<li>Host B rooted using same method</li>
<li>Rinse &amp; repeat for C &amp; D</li>
</ol>
<p>In summary, if you are looking at a cloud solution and your web presence is important take an informed decision from one of the larger providers, and <strong>NEVER EVER</strong> go with the cheapest option you could find, probably on ebay &#8230;</p>
<p>The cloud is not some magical being created by the hosting fairies that will take all your hosting and maintenance woes away, it may or may not be the right thing for your business / web app, and in certain instances can lower TCO, I for one will be sticking with my Cluster services and high Availability designs for a while yet.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/hosting/cloud-hosting-my-views" data-text="Cloud hosting &#8211; my views" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fhosting%2Fcloud-hosting-my-views&#038;text=Cloud%20hosting%20%26%238211%3B%20my%20views" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/hosting/cloud-hosting-my-views/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The zen of secured shared hosting part 1</title>
		<link>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1</link>
		<comments>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1#comments</comments>
		<pubDate>Fri, 24 Oct 2008 08:20:02 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[suPHP]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1</guid>
		<description><![CDATA[Welcome to part one of the &#8216;zen of secured shared hosting&#8217; series. In this part I will be covering the concepts of secured shared hosting, and why you as a shared hosting provider should be taking steps to ensure this is how you deploy your hosting environments. Let&#8217;s first take a typical L.A.M.P setup: PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to part one of the &#8216;zen of secured shared hosting&#8217; series.</p>
<p>In this part I will be covering the concepts of secured shared hosting, and why you as a shared hosting provider should be taking steps to ensure this is how you deploy your hosting environments.</p>
<p>Let&#8217;s first take a typical L.A.M.P setup:</p>
<p>PHP Compiled from source as apache module.<br />mySQL installed from RPM or update package (yum / up2date).<br />HTTPD installed as RPM or update package (yum / up2date).</p>
<p>Please note at the time of writing if you yum / apt-get / up2date install your PHP package you will have varying results when attempting to compile and install suPHP, as such grab the source code from php.net, and follow this series.</p>
<p>As a shared hosting provider lets say you have 5 clients all hosted from the one server, each client using vsftpd is chrooted() into their home directory, and their ssh access disabled, supposedly secure enough.</p>
<p>Unfortunatly not so, due to the L.A.M.P configuration the &#8216;apache&#8217; user needs a minimum of read and execute permissions over all the PHP files on the system, why is this a problem?</p>
<p>This is a problem largely due to human nature of the client, your &#8216;joe bloggs&#8217; client doesn&#8217;t care about the technical aspects of web hosting or websites, they just want an easy pretty interface to get their corner of the internet online, downloading something like drupal or joomla.</p>
<p>Now this isn&#8217;t a dig at open source CMS, this is an insight into human nature, look at the changelog for any open CMS and you will see &#8216;security fixes&#8217;, unfortunatly all &#8216;joe bloggs&#8217; cares about is that their website is working, and this is wher things take a turn for the worse.</p>
<p>Joe Bloggs never updates his open CMS platform, meaning any vulnerabilities patched in subsequent releases are still exploitable on his website, worst case scenario that this is an XSSI (Cross Server Script Includes) vulnerbility.</p>
<p>An attacker finds this website and idetifies the security hole, using XSSI to install a PHP interactive shell, giving the attacker SSH like access to the hosting environment, most people at this point think so the attacker has compromise one site &#8230; so what we can restore that site from backups and it&#8217;s only one site that&#8217;s affected, the other 4 users either do not use open CMS or are up to date with all the security patches.</p>
<p>Well that&#8217;s where you would be wrong, with the hosting setup outlined above the SSH like PHP shell is now running as the apache user, meaning the attacker can go anywhere and read anything apache can, and with the hosting setup oulined above that mean reading things like datbase connection files, suddenly all the clients on the hosting environment have their websites compromised as the attacker gains mySQL access and starts changing content on thewebsites, despite the fact that the other 4 sites themselves were never exploited.</p>
<p>One clients error just became a cascading exploit on your hosting platform, now make that a more realistic platform say 30 clients on the box, some are online shops, the issue just became a whole lot bigger there is lost revenue due to downtime of the shop sites, and worse still the attacker now has access to any customer details those shops were storing! but it&#8217;s not Joe Bloggs that&#8217;s accountable it&#8217;s YOU as the hosting provider, you can take steps to prevent one exploited site becoming 30, and this web series will tell you host to do it.</p>
<p>coming in part 2:</p>
<p>an introduction to suPHP<br />compiling php as a cgi binary, and why you need to do so</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1" data-text="The zen of secured shared hosting part 1" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fthe-zen-of-secured-shared-hosting-part-1&#038;text=The%20zen%20of%20secured%20shared%20hosting%20part%201" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iTX Clustering project &#8220;green&#8221;</title>
		<link>http://www.saiweb.co.uk/hacking/itx-clustering-project-green</link>
		<comments>http://www.saiweb.co.uk/hacking/itx-clustering-project-green#comments</comments>
		<pubDate>Thu, 08 May 2008 15:26:09 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Green Giant]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[clustering]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[itx]]></category>
		<category><![CDATA[pico]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/hacking/itx-clustering</guid>
		<description><![CDATA[So I have a concept for a 24 node cluster, I want to build to run folding@home and other cancer research projects The spec is to make it as &#8220;green&#8221; as possible, the lower the watts/ghz the better, whilst still maintinaing performance. The downside is the pricing of pico-ITX at the moment, I&#8217;m getting quotes [...]]]></description>
			<content:encoded><![CDATA[<p>So I have a concept for a 24 node cluster, I want to build to run folding@home and other cancer research projects</p>
<p>
<p>The spec is to make it as &#8220;green&#8221; as possible, the lower the watts/ghz the better, whilst still maintinaing performance.</p>
<p>
<p>The downside is the pricing of pico-ITX at the moment, I&#8217;m getting quotes for about £200 / node &#8230; and that&#8217;s without ram, or storage &#8230;</p>
<p>
<p>What I need is the following.</p>
<p>
<p>pico-ITX form factor motherboard with ~1ghz CPU, in quantities of 5 or more</p>
<p>
<p>So please leave a comment or use the contact me form if you think you can help, or have any information on suppliers.</p>
</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/hacking/itx-clustering-project-green" data-text="iTX Clustering project &#8220;green&#8221;" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fhacking%2Fitx-clustering-project-green&#038;text=iTX%20Clustering%20project%20%26%238220%3Bgreen%26%238221%3B" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/hacking/itx-clustering-project-green/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New host</title>
		<link>http://www.saiweb.co.uk/general/new-host</link>
		<comments>http://www.saiweb.co.uk/general/new-host#comments</comments>
		<pubDate>Thu, 20 Mar 2008 14:35:56 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/general/new-host</guid>
		<description><![CDATA[Due to latency issues, and the lack of multi site support I have ditched my old web-host.  In favour of an all singing all dancing NEW ONE! nativespace thus-far I have had excellent ticket turn around (all in 30 mins or less), and my initial sales enquiry (consisting of a lot of lengthy questions)  responded to [...]]]></description>
			<content:encoded><![CDATA[<p>Due to latency issues, and the lack of multi site support I have ditched my old web-host.</p>
<p> In favour of an all singing all dancing NEW ONE! <a href="http://my.nativespace.co.uk/aff.php?aff=044" title="nativespace advanced afordable hosting">nativespace</a> thus-far I have had excellent ticket turn around (all in 30 mins or less), and my initial sales enquiry (consisting of a lot of lengthy questions)  responded to in &#8230;. 6 minutes!</p>
<p>So thus far definitely on my recommended list<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/general/new-host" data-text="New host" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fgeneral%2Fnew-host&#038;text=New%20host" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/general/new-host/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 22/65 queries in 0.075 seconds using apc
Object Caching 1688/1808 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 16:22:58 -->
