<?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>leewillis.co.uk&#187; Lee Willis</title> <atom:link href="http://www.leewillis.co.uk/tag/performance/feed/" rel="self" type="application/rss+xml" /><link>http://www.leewillis.co.uk</link> <description>Building a business on Open Source</description> <lastBuildDate>Thu, 26 Aug 2010 19:20:39 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Gzip in Joomla &#8211; Tips for a faster website</title><link>http://www.leewillis.co.uk/gzip-joomla-tips-faster-website/</link> <comments>http://www.leewillis.co.uk/gzip-joomla-tips-faster-website/#comments</comments> <pubDate>Wed, 13 May 2009 09:30:04 +0000</pubDate> <dc:creator>Lee</dc:creator> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[hints]]></category> <category><![CDATA[joomla]]></category> <category><![CDATA[performance]]></category><guid
isPermaLink="false">http://www.leewillis.co.uk/?p=75</guid> <description><![CDATA[The average internet connection is much more capable of delivering sizeable web content today than it was even 12 months ago &#8211; the UK average broadband connection at time of writing is 4.6Mb/s. The problem It&#8217;s important to remember that: Not everyone has broadband Most web browsers don&#8217;t take advantage of the bandwidth available GZIP [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.leewillis.co.uk%2Fgzip-joomla-tips-faster-website%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.leewillis.co.uk%2Fgzip-joomla-tips-faster-website%2F&amp;source=leewillis77&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br
/> </a></div><p>The average internet connection is much more capable of delivering sizeable web content today than it was even 12 months ago &#8211; the UK average broadband connection at time of writing is 4.6Mb/s.</p><h2>The problem</h2><p>It&#8217;s important to remember that:</p><ol><li>Not everyone has broadband</li><li>Most web browsers <a
href="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">don&#8217;t take advantage of the bandwidth</a> available</li></ol><h2>GZIP Compression</h2><p>If you&#8217;re developing a site in Joomla for example you often hear people suggesting <em>&#8220;turn on compression</em>&#8221; within Joomla. This option compresses the page content created by Joomla before sending it back to the browser in real-time.</p><p>While this is a great solution for some sites, there are significant issues with this approach for many sites. It&#8217;s important to realise that the HTML page is only 1 of the many requests needed to generate a webpage &#8211; you also need all of the images, CSS files, and JS.</p><p>Take for example a typical template from YOOtheme &#8211; a major Joomla theme provider. The actual HTML for <a
href="http://demo.yootheme.com/mar09/index.php">March 2009 theme demo</a> is 1 out of 31 requests, and just 7kB out of a total of 144 kB.</p><p>It&#8217;s worth noting that if the objective is to make your site &#8220;faster&#8221; then Joomla&#8217;s gzip may not be the best option. The downsides to this approach are:</p><ul><li>It only affects the size of the HTML page</li><li>It does that by compressing the content on-fly<ul><li>Cacheing aside &#8211; this can result in you compressing the file every time it is requested &#8211; adding a significant processor load to your server</li><li>The process of compressing the data adds a delay (However small) before your content can be sent</li></ul></li><li>It does nothing about the other files that make up the webpage</li><li>It doesn&#8217;t maximise your bandwidth usage by minimising total number of requests</li></ul><h2>My Approach</h2><p>For the sites that I run I use the following approach:</p><ul><li>Identify files that are included widely, but updated infrequently</li><li>Consolidate multiple files into one (ie, create just one .js file for your site, and one .css file)</li><li>Create a compressed version of these files alongside the original</li><li> Use a bit of .htaccess magic to serve the compressed files to everyone who can deal with them.</li></ul><p>This is a good solution for files which don&#8217;t change frequently (CSS, template images, JS includes etc.) This approach gives you the best of both worlds, compressed files, but low server CPU impact.</p><h2>The HOWTO</h2><p>To implement it simply create a compressed copy of the file(s) you want to compress. If you have shell access to your website files you can do:</p><div
class="code">$ gzip -9 -c foo.js &gt; foo.jsgz</div><p>This should leave you with your original uncompressed file, and a compressed variant with the suffix &#8220;gz&#8221;.</p><p>Now add the following to your .htaccess file:</p><div
class="code"> #Check to see if browser can accept gzip files.<br
/> ReWriteCond %{HTTP:accept-encoding} (gzip.*)<br
/> #make sure there&#8217;s no trailing .gz on the url<br
/> ReWriteCond %{REQUEST_FILENAME} !^.+gz$<br
/> #check to see if a .gz version of the file exists.<br
/> RewriteCond %{REQUEST_FILENAME}gz -f<br
/> #All conditions met so add .gz to URL filename (invisibly)<br
/> RewriteRule ^(.+) $1gz [L]<br
/> AddType &#8220;text/css;charset=UTF-8&#8243; .cssgz<br
/> AddEncoding gzip .cssgz<br
/> AddType &#8220;text/javascript;charset=UTF-8&#8243; .jsgz<br
/> AddEncoding gzip .jsgz</div><p>Remember if you do change any of the uncompressed versions you&#8217;ll have to re-generate the compressed version otherwise clients that support gzip won&#8217;t see the changes.</p><p>There are some complications when using Joomla with Virtuemart (Since it insists on loading CSS/JS support files itself) &#8211; but that&#8217;s a topic for another day!</p><p>When we implemented this on <a
href="http://www.snugbaby.co.uk/">SnugBaby</a> it reduced the total number of files required from over 35 to 27, and the total download size from over 200k to 144k &#8211; would love to hear other&#8217;s experiences.</p> ]]></content:encoded> <wfw:commentRss>http://www.leewillis.co.uk/gzip-joomla-tips-faster-website/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 9/18 queries in 0.006 seconds using disk

Served from: www.leewillis.co.uk @ 2010-09-09 14:51:44 -->