http://www.dart-creations.com/joomla/joomla-tutorials/how-i-got-my-website-to-load-in-129seconds.html
A number of optimizations you can and should to make sure your Joomla (or any other CMS) website loads as quickly as possible
1. How I got my website to load in 1.29seconds
dart-creations.com/joomla/joomla-tutorials/how-i-got-my-website-to-load-in-129seconds.html
By David Attard
We've been hearing f or a while that SEO may be af f ected by the time your page takes to load - so
recently we've started an intensive exercise of getting our website to load in the absolute minimal time
possible. Our belief is that the current load speed and rating in GTMetrix is relatively good 85% f or
PageSpeed, and 95% f or YSlow Grade and a load time of 1.29seconds, so we thought we'd share how
we did this. Some of these are Joomla! specif ic, but the general concepts apply to ANY content
management system and any website.
Bef ore you begin: Run your website through GTMetrix. Take note of your current grade and then watch it
improve. The good thing is that GTMetrix tracks your history too so you can see a graph with your
improvements!
STEP 0: TAKE FULL BACKUPS - Some of the f ollowing recommendations may break your site. Take
f requent f ull backups bef ore making any changes.
Step 1: Set yourself an ambitious target and fixate on it until you get it
This is an absolute must. If you don't have a target, then you're unlikley to keep pushing. You must your
set yourself an ambitious target and strive to achieve it BEFORE you start optimizing. For us, our target
was to reduce the load time of the f rontpage to less than 1.5seconds AND get at least 85% on
both Pagespeed and YSlow.
Our end result. Not too shabby :)
Step 2: Enable the default Joomla Cache
This is pretty simple however it is VERY ef f ective. Mostly this is because rather than running the same
queries over and over again against your database, the cache stores a copy of your page and serves it
f rom a temporary f ile. This eases the load on your server and improves the general load time of your
server. To enable your cache do the f ollowing:
System > Global Conf iguration > System
Switch Progressive Caching On, and set the cache expiry to 60 minutes especially if your content doesn't
change too of ten.
Step 3: Enable GZIP Compression
This step ensures that the content you generate is compressed bef ore it is sent. The logic is very
simple, it takes much less time to compress and decompress content rather than transf erring large
2. pieces of content. This is something which can also be done easily in Joomla 3 with the f ollowing:
System > Global Conf iguration > Server
Switch GZIP compression to YES.
Step 4: Enable the System - Cache plugin
This plugin caches each whole page on your site and optionally recommends to your browser and this
page should be cached f or some time. Browser side cache makes a lot of sense especially because you
won't need to redownload certain images and f iles over and over again. The browser will use the local
copy and thus less data transf er is required and hence your pages load f aster. This is especially
ef f ective f or stuf f such as the CSS and images of your stylesheet. This is also standard Joomla
f unctionality enabled via the f ollowing:
Extensions > Plugin Manager, search f or Cache and enable the System - Cache plugin. You should also
go to the Basic Options of the plugin and set it to YES.
Step 5: Leverage Browser Caching at the server level
This is very similar to Step 3, and is strictly related to Browser caching. However this is done at the
server level. Basically, you'll need to recommend to the Browser to cache certain f iles types f or a specif ic
amount of time. Google PageSpeed suggests at least ONE MONTH. To do this, you will need to edit the
.htaccess f ile to the f ollowing. The max age value is 1 month in seconds.
<FilesMatch ".(ico|pdf |f lv|jpg|jpeg|png|gif |js|css|swf )$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
Other values you might want to consider:
1 YEAR:
Header set Cache-Control "max-age=29030400, public"
1 WEEK:
Header set Cache-Control "max-age=604800, public"
You might also choose to cache less or more f ile types, but the above are the most common static f iles
which can and should be cached.
Step 6: Install JCH_Optimizer
JCH Optimizer contains a HUGE number of recommended stuf f by PageSpeed and results in a huge
boost in your PageSpeed grade. The problem you might encounter is that this may break some of the
f unctionality on your website. Tread caref ully with the options you enable. For our site we managed to
enable nearly all optimizations with very f ew exclusions - but f or your site, you might have to play around
f or a while to f ind the optimal settings. Describing JCH Optimizer is a bit beyond the scope of this article,
but take our word f or it, install and enable the plugin. You won't regret it.
The f ollowing is part of the of f icial description:
This plugin combines your external JavaScript and CSS f iles into one to minimize expensive http
requests. These f iles can be minif ied and gzipped to reduce bandwidth and f urther optimize download
time.
Step 7: MINIFY the content of your site
This is VERY important. Make and keep your site absolutely lean. This is the one which you should spend
3. most time on. We spent weeks on this step alone.
NB: Tread carefully here. Take full backups before deleting core Joomla! components, modules
and plugins
Do this with until you exhaust yourself . Really, do this. Remove ALL stuf f which you are not using. Even
stuf f which comes as def ault but which you won't be needing, such as the def ault template which you
won't use ever again, the web links components which you are probably not using, the newsf eeds
components if you are not using them, and ALL the plugins which you will never use. Uninstall them, not
just disable them. Obsessively f ocus on stuf f which you don't need, remove all the extra components,
and combine modules and plugins if possible. E.g. f or social buttons use 1 plugin f or everything. If you
have custom html, put as much of it into a single module as possible. Delete extra f orum categories, and
minif y the number of items in your menus to the utmost necessary. Delete old users and old contents.
Merge and combine sections, categories, menus and anything else as necessary. Your f ocus should be
to get things down to an absolute minimum required f or your site to exist. Do this obsessively f or a
number of weeks. Go on a deletion spree, chop and remove, disable and uninstall. Focus on making you
site as lean as humanly possible without breaking anything.
Unf ortunately, we did not keep track of the stuf f we removed.
Step 8: MINIFY the total number of requests.
Remove extra images which are superf lous. Host a version of any images which are served f rom external
websites and link to a copy on your site (this will reduce the number of DNS lookups which your client's
browser will need to perf orm since these have a severe impact of the page speed of your site). Analyse
in detail what the requests are with GTMetrix or Pingdom perf ormance tools.
GTMetrix also has a cool f eature which will optimize the size of all your images. Save the versions which
have been optimized and use the optimized versions in your website.
Step 9: Serve content from a CDN
Content Delivey Networks are servers which cache a copy of the static parts of your site and can serve it
optimally and much f aster than your server ever could to your visitors. This will give you another HUGE
boost to your page speed. If you can't af f ord a CDN, sites such as Cloudf lare have a FREE plan, which
will serve the needs of most small websites.
Step 10: Follow each recommendation on PageSpeed, YSlow
Both PageSpeed and YSlow have a number of detailed recommendations, such as specif iying a def ault
character set and ensure you have specif ied image dimensions (specif y the width and height f or each
image in your website). For any content which is hosted on your site, f ollow each of these to the letter. If
you have no clue what you need to do, Google is your f riend, read about it and understand it and action
it on your website. Avoid bad requests, i.e. make sure there are no images or f iles which are incorrectly
linked. Some can be quite dif f icult to do unless you really know what you are doing (e.g. CSS sprites - we
never were able to get this to work). Loads 3rd party scripts such as Facebook, Twitter, Adsense and
Google Analytics asynchronously. There are many f airly easy optimizations which you can do.
PS. There might be recommendations which you cannot f ollow f or content which is hosted outside of
your control. E.g. AdSense, Facebook, and other scripts all have some optimizations they can make. You
don't have much control over these. The good thing is that your CDN might also have optimizations f or
3rd party content too. If not, don't worry too much about them.
If you keep iterating with optimizations, you should eventually arrive at a point where your site becomes
lightning f ast.
Have you achieved good results with the above recommendations? Share your experience with us in the
comments below!
David Attard
Joomla is something which I've been working with as my web development platf orm f or the last 6+ years
... with as much dedication as possible besides my f ull time job in security. My website contains many f ree
Joomla! resources to help our newbie and advanced Joomla webmasters. Whatever has helped me, I put
4. out on the web in the spirit of helping out with Joomla! since it has provided me with such a great tool.
Website: http://www.dart-creations.com
< Prev Next >