How many times have people said that your website is too slow and you found out that there is nothing you can do to improve its performance? The final option most of the times might have been either trying to change your hosting server (may be even blaming him for purposely slowing your website) or finding several ways to optimize your code.

Website performance

Over last few months I have been facing this same problem. I browsed the web for answers, even went ahead and bought many books on Website Optimization. All of them more or less targeted the same issue of caching static contents using additional third party tools which improvises upon browser caching thus getting better performance and all that sort of stuff.

Analyzing the Website Performance

There were enough options to start that made me crazy as to which one to go ahead with, I wanted things to be under my control rather than adding complexities. For this I needed information as to what actually is traveling between my web server and web browser. I added loggers in my code to note the timestamps at server, even timed by database queries.

All I wanted to know was what actually was being downloaded by the client. In this situation one tool finally came to my rescue. That was Yahoo YSlow. It helped in finding:

  • The contents of the response object which gave a picture of images, scripts, and style sheets that were being downloaded from the server.
  • The content size and time taken to download each of them.

Using this tool I came to know that the gzip feature to compress the html pages was not working. I even found some old images hidden in Java script which where never being displayed but where getting unnecessarily downloaded.

Improving the Website Performance

With the above analysis, I managed to fix the performance of my web site. These are two things which I would suggest you to try out in order to improve your web site performance.

1. Minifying JavaScript and CSS files

An important step in improving the load speed of a website is to reduce the download time taken by JavaScript and CSS files. In my case, the attention was focused to minify these files. As a Java developer I always want properly intended code with comments to debug the script. But this actually increases the script size and degrades the website performance, hence one must make sure that CSS & JavaScript files are minified before being deployed in production server. It helps to boost the website performance.

You can check the source code of Google homepage to see they how the JavaScript, HTML file and style sheets are being minified to the best possible way. The loading time for a Google page itself reveals the advantage of using this technique.

2. Combining small images into ONE image

Combine small icons into a single image and use image map to display the section of the image. This feature is being used by many websites for improving performance since a single request is much faster than making 10 individual requests.

Even Microsoft has followed the style of combining multiple images into one, in its search engine home page Live.com. If you see the background image of the page then, you will notice that all small images have been combined to form a single png file.

Fixing these simple issues improved my website performance by 13-15% without actually spending money on increasing bandwidth or taking any extra efforts. However I would like to know if there are any other steps which might help further in improving a site performance.

(Ninad Gawad is a Java EE Developer who blogs at Technology Discussion)


Stumble Digg Technorati Subscribe Delicious