17.03.2010 at 11:39 pm | Web Boulevard | RSS 2.0 feed | leave a response | trackback
You are here: Home » Web Boulevard » Taking my Blog to the Next Level (Part 4): Speed Optimization

Continuing from part 1 (falling in love with your blog again), part 2 (widgetizing & thumbnailing) and part 3 (search engine optimization), in this part I share the steps I’ve taken to enhance the speed and performance of my blog.
Why is your blog speed important? Many reasons really:
- Affects your search engine optimization, yep bots do care about how fast your page loads
- Increases your site traffic indirectly; users are not patient, if your page takes some time to load they might close it down before it does
- Faster means less bandwidth means less costs
A good place to start is a quick health check, I use GTMETRIX which is money free, registration free, and awesome. It gives you basic ratings from Yslow (Yahoo) and page speed (Google) plus tips on what needs to be optimized.
Speed enhancement is mostly about caching really. I will divide this post in two parts, manual bits and plugin bits.
Expiry headers controls elements which browser can cache instead of fetching from the server every time a user visits. Files like CSS, images and javascript which do not change much often are safe to cache. It won’t affect the load speed for first time visitors (or one page visitors), but it will do so significantly for return users and users browsing starting from the second page they view.
I am still not 100% done with my CSS changes so I chose not to cache them for the time being.
My server is Apache and hence I edited my .htaccess file with the following parameters (thanks to google of course):
# BEGIN Define Mime Types <IfModule mod_mime.c> AddType application/x-javascript .js AddType application/x-shockwave-flash .swf AddType image/bmp .bmp AddType image/gif .gif AddType image/jpeg .jpeg AddType image/jpg .jpg AddType image/png .png AddType image/tif .tif AddType image/tiff .tiff AddType image/x-icon .ico </IfModule> # END Define Mime Types # BEGIN Headers: Ensure browser caching of objects for 1 month # Set Expires header <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A0 ExpiresByType application/x-javascript A2592000 ExpiresByType application/x-shockwave-flash A2592000 ExpiresByType image/bmp A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/jpeg A2592000 ExpiresByType image/jpg A2592000 ExpiresByType image/png A2592000 ExpiresByType image/tif A2592000 ExpiresByType image/tiff A2592000 ExpiresByType image/x-icon A2592000 </IfModule> <FilesMatch "\.(bmp|ico|js|tiff|tif|gif|jpeg|jpg|png|swf)$"> <IfModule mod_headers.c> # Set Pragma header Header set Pragma "public" # Set Cache-Control header Header append Cache-Control "public, must-revalidate, proxy-revalidate" </IfModule> # Set Entity Tag header FileETag MTime Size </FilesMatch> # END Headers: Ensure client-side caching of objects
Note that I have removed CSS (Stylesheet), HTML (web pages), plain TEXT and XML files from being cached.
You can read about ETags here, they have to do with setting up change frequency of content by adding requests to the HTTP headers of the site allowing your web pages, the server, and your browser to talk to each other and identify if a page needs to be refreshed from cache or not. I personally do not utilize this in my site so I opted to disabling ETags all together as recommended.
The .htaccess settings above take care of that, however before I applied those, I used to have this in my .htaccess:
FileETag none
After doing some research, I am convinced that the best tool to use (and easiest to setup and configure) is w3 total cache.
This tool is totally awesome! It supports page and database caching , it also supports minifying CSS and JS files, and it supports Content Delivery Networks whether external or self hosted.
I installed the plug-in following the instructions in the readme file. I then retained basic / recommended settings for the tool:
My Current page ranks at B on YSlow! (Yahoo) and B on Page Speed (Google) which is really awesome compared to D and D before undergoing this optimization practice. I still haven’t utilized CDN as well, once done I believe I will be hitting A’s.

This is the 4th and last part and where this experience sharing ends. If you have any questions, please post them.
Lets us know if you have used any tips from the 4 parts experience. Have you?

March 21st, 2010 at 1:45 pm
thank you very
March 21st, 2010 at 3:42 pm
thank you very much
April 16th, 2010 at 5:49 am
Thank for this great post, i like what you
read.
July 1st, 2012 at 7:15 pm
[...] Taking my Blog to the Next Level (Part 4): Speed Optimization [...]
July 1st, 2012 at 9:18 pm
[...] Taking my Blog to the Next Level (Part 4): Speed Optimization [...]
August 25th, 2012 at 1:21 am
[...] Taking my Blog to the Next Level (Part 4): Speed Optimization [...]