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.
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
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.
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
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.
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.
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.
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.
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.
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.
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.
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.