Top 3 optimizations you can apply to your site front-end

Apr 14, 2009
German Villacreces

This may be trivial to you by now, but i'm posting this anyway cause someone has to! And I'm hoping to get feedback from readers that get good results and discover other ways of optimizing a site.
 
When optimizing most websites, its important to know that stylesheets, scripts and images account for over 75% of the load time. There are several ways to reduce this time, i am gonna explain the top 3 solutions that have the most impact.

1. Number of requests: If your site has a lot of files requested it will dramatically increase the page load time, you have to avoid duplicating requests and even come up with new ways to replace a group of requests with only one. You should only have ONE stylesheet for the entire website placed on the <head> tag of your pages. Join all possible javascript files into one and place it at the bottom of the page, just before the </body> enclosing tag. Avoid using several dummy images like cornered borders, just make them a single image and use the background-position property to display them. This technique is very useful when you want an image link/button mouse over effect, all the states of the link/button should be one single image. Ultimately, try to use more css than images.

2. Content Delivery Network (CDN): Use a CDN for all static files like images, swf files, css. The more you move to the CDN the less load on your webserver and the lower the latency of all the static files loaded. CDNs are not as expensive as they seam, SimpleCDN prices starts at 0.04 $ per GB check it out.

3. Caching & Compression: These are two great ways of reducing page load, make sure you use GZIP in your web server, Apache supports this by default. Minify your javascript files, this means removing the spaces and linebreaks. Last but not least set up the expires header.

There are several other optimizations you can apply to your site, a great tool that describes these and measures the results is YSlow. YSlow is a firebug plugin that rates your site depending on 13 basic optimizations your site should have. Take it seriously and try to get the highest rate.