Blog

thoughts and opinions on the business of building websites

Is your Joomla site ready for take off but not quite performing?

Joomla site slow? Here's some pointers (part 2)

  • John Pitchers
  • Blog

Is your site a bit slow and laggy? In part 2 of this series we'll discuss some third party extensions, hosting options and compare our example Joomla site before and after optimisation.

If you missed it, be sure to read Part One of this article first. If you read Part One and are back for more then lets get straight into it.

Joomla Extensions

You don't have to be a hardcore coder to make effective changes to improve the speed of your Joomla website. There are a few great extensions I highly recommend that will help a lot.

Merging, minimizing and compressing

Firstly, install a plugin to combine and compress your CSS and Javascript files. I've used a few but here are two that I've had the most success with.

  1. JBetolo. This plugin combines and minimises CSS and Javascript files ultimately reducing the number of http requests to your server. There are a swag of other optimisation options for you to experiment with but always experiment on a test site.
  2. JCH Optimize. Again, this compresses and minimises CSS and Javascript files and provides options to load the JS at the top or bottom of the page. You can also combine template images into a single sprite but not all templates will work well doing this. JCH Optimize doesn't have as many configuration options as JBetolo but I do like the simplicity of this plugin.

Be warned. On complex sites, these plugins may break some functionality but they include options for you to exclude files from the merging process. Even, when you know what you are doing it may take some time to set these plugins up properly.

Delayed image loading

Lazy Load for Joomla. This plugin is so simple and so effective. It's a must have. Images below the visible area aren't loaded until your visitor scrolls down the page and the image comes into view. When that happens the image shows with a nice fade in effect.

It is probably more accurate to say this plugin gives the illusion of speeding up your site because the loading of images is delayed until after all the content is presented to the user.

I've had awesome results speeding up sites with this plugin and it's got the added benefit of reducing your bandwidth.

You can also exclude bots so Google can still search and index your images.

Hosting

Shared hosting environments are great. For a few dollars a month you get to host your site on sophistcated, expensive hardware maintained and upgraded by qualified staff with on call service 24/7. However, dozens or hundreds of sites residing on a single server can put a drain on it's resources. There are good and bad shared hosting services at the same price points. Make sure you do your research, listen to the advice of your developer, check discussions on Twitter and forums like forums.whirlpool.net.au. In our experience cheapest is never the best.

Dedicated servers on the other hand serve just your content with 100% of it's resources at your beck and call. Howerver, Australian dedicated servers generally cost several hundred dollars a month. You are usually given shell access to manage the Operating System and software yourself. For medium to large organisations with an IT team in place this is a perfect option. Not so for small business.

Virtual Private Servers or VPS hosting is a cross between Dedicated Hosting and Shared Hosting. You have the option to configure your own software and other aspects of the server the same way you can with dedicated hosting but you will have only a partition space within server and not the whole. It can provide your site with good control and bandwidth and cost less as compared to a dedicated server.

We recently conducted a very simple test using Google PageSpeed on 6 Joomla sites hosted on 6 different Australian shared hosts and 3 sites hosted on dedicated servers. The PageSpeed reports for all 6 shared hosts recommended "Improve server response times" as a medium or high priority item. None of the tests on dedicated servers showed this recommendation.

Content Delivery Networks

What is a CDN? A content delivery network deploys your website across multiple data centers around the web. The purpose is to serve your assets (images, css, javascript) from the server nearest to your end user.

I believe the real benefit for Australian website owners is in serving content to international visitors. If the vast majority of your visitors are in Australia and your site is hosted in Australia then a CDN may not be beneficial unless your server is under a lot of load. International visitors on the other hand will notice a clear speed improvement as your site is served from a location close to them regardless of whether they are in Asia, US or Europe.

There are a lot of options when using a CDN. The simplest one I've used is Incapsula. It also acts as a firewall blocking spam comments and the like. For this reason alone, the free version of Incapsula is well worth setting up - especially for bloggers.

After you create your account, you need to add a DNS setting to your domain to route traffic through the CDN. Once that has propogated, Incapsula starts caching your files on their servers and filtering out bad traffic (like hack bots and comment spammers).

CloudCache is another popular CDN. This one isn't free but plans start at only $9/month. To get started with Cloudcachenonumber.nl have a CloudCache CDN Plugin. Check out this video on how CloudCache and CDN in general can work for your site.

Blocking bots and spammers

We touched on this above but it can be a huge speed factor on popular sites. Let's demonstrate.

fw awstats

This AWStats screenshot is of data from a year ago from one of the more popular sites we maintain. You can see 500,000 hits/month from China consuming 26 Gigabytes of bandwidth. This site is a prominent Australian site directed at an Australian audience. It contains no internationalisation or foreign content. Yet, at certain times of the day, the site would slow to a crawl as it was bombarded with hundreds and thousands of hits from Chinese servers. These hits are from spam bots and hacking scripts constantly probing the site. Over 1000 spam comments were being identified by Akismet every day.

As a site grows in popularity and becomes more prominent this becomes a bigger issue. Thankfully, there are simple ways to counteract this.

IP blocking

Generate an IP block list to add to your .htaccess file. I use http://ipinfodb.com/ip_country_block.php to generate a country specific list of IP addresses. Select the country and the output type ("Apache htaccess deny" will work for most Cpanel based servers). Just paste the output into the .htaccess file in your site root.

This should have an immediate affect blocking bad traffic. But, you will need to regularly monitor your stats and update the list with new IP addresses yourself as they show up.

CDN filtering

The Incapsula service described above does an excellent job blocking specific countries from your site. Just select the relevant countries in your preferences.

Blocking entire countries from accessing your site is an extreme measure as you will be blocking a certain amount of legitimate traffic. If you are unsure if traffic is malicious check the content of your error logs. You may see lots of URL's with code attached and strange links to your adminsitrator area. You'll be able to match these to the IP addresses in AWStats.

What results can you expect?

In part one we showed the speed test results of this site joomstore.com.au/blog and bytebank.com.au before applying any of the optimisations outlined in these articles. For the comparison tests, I've installed and configured JCHOptimise and LazyLoad for Joomla and added the .htaccess code to enable GZip and expires headers. We don't get the type of traffic a high profile news site would so we don't have the need for a dedicated server or CDN so the results below could be even better. Here's the before and after comparisons using www.webpagetest.org.

Joomstore.com.au

Before:
webpagespeedtest-joomstore8-4-13

After:
webpagespeedtest-joomstore-15-4-3013

As you can see the initial loading time has been reduced by 42% (nearly 4 seconds). The HTML and all the CSS and Javascript files have been combined together where possible and compressed dramatically reducing the number of HTTP requests and the amount of data to be downloaded. Content is rendering on screen within 3.2 seconds which is great.

Subsequent page load times are reduced by about 17% over the unoptimised version of the site. Most of the assets have been loaded into memory and cached already so the difference isn't as great as the initial page load.

Bytebank.com.au

Before:
webpagespeedtest-bytebank8-4-2013

After:
webpagespeedtest-bytebank15-4-2013

I was expecting a good results but this test blew me away. The initial loading time has been reduced by 70%. Subsequent page load times are reduced by about 83% over the unoptimised version of the site.

The reason for such a huge impact is due to fact that this site is much simpler and doesn't have the complexity of the first site. Compression and caching speeds up your site by reducing the amount of data to be transmitted from server to browser. The server still needs to process the request and serve the HTML. The browser needs to interpret the HTML, retrieve the assets and render to the screen. The speed of these internal processes will always be governed by the compexity of the site in question. The cleaner and simpler a site is, the less work required at both ends.

In Conclusion

Without a doubt, the best way to achieve a fast loading site is to remove the bloat. For years, we've been told by everybody - usability experts, SEO experts, Google - to concentrate on the content. And that impediments like poorly implemented sliders, overly complex navigation and slow websites actually turn visitors away from your site. Our advice is, if it's absolutely not required then remove it from your site.

Do you really need tabbed content in a sidebar? Do you really need a content slider of which most of the content will not be seen? Do you really need the scrolling news ticker distracting your visitors? Do you really need the javascript popup/flyover/bounce-in/whatever affect that looks "really cool"?

Beyond removing the bloat from your site, most of the other points (other than setting up a dedicated server) are quite simple. It's something that most Joomla developers can do in the space of an afternoon.