Mempercepat JOOMLA

Consider Joomla! as a framework over which one can develop, integrate components and launch a
professional feature rich web sites. Joomla’s flexibility and ease of usage makes it a popular CMS, which has resulted in a vast community and tons of extensions, only imagination can restrict the use of Joomla. Then why is Joomla slow?
Joomla itself is not slow, one needs to tweak settings and use the available inbuilt options to boost up performance. If Joomla developer’s were to optimize joomla performance by default, then it would be difficult for us to customize joomla and much more difficult to make functional changes. Its up to the user to get the maximum out of joomla by tweaking settings and optimizing Joomla framework. Default Joomla has lot of potential to be optimized for speed and performance.
To prove our point we investigated Joomla performance by analyzing a Joomla 1.5.9 default installation.


HTTP Requests Total Page Size (bytes) Total Loading Time ( @ 56 K) ScreenShots
Default Joomla 55 1,00,093 30.95 j_159_default_installation
Joomla with Ja_Purity Template 159 2,22,572 76.16 j_159_default_japurity
With GZIP On 159 1,95,436 70.75 j_159_default_japurity_gzip
With GZIP + Cache 159 1,95,420 70.75 j_159_default_japurity_gzip_cache
CSS edits. Compression & Minification of  site. 80 58,037 27.57 j_159_final_banner_removed

Conclusions :

  1. Speed and performance of Joomla is largely dependent on the choice of template, followed by addons components / modules / plugins.
  2. Number of CSS images, Javascripts (size) marks the final blow to Joomla performance.
  3. Activation of inbuilt Gzip and Cache system does speed up the Joomla site.
  4. Cleaning up of CSS codes can result in a highly boosted Joomla performance in terms of decreased http requests and total page size.
  5. Compression and minification of CSS / JS files, similarly compression and optimization of pics / images is the key to speed up default Joomla.
  6. As a demonstration we called two css files with one line of code resulting in 1 less http request.

Points to ponder :

  1. We did not remove any of the modules / components from the default joomla installation.
  2. We used the inbuilt template “Ja_purity” for the above testing with default settings.
  3. The above results are based purely on minimal alterations of files.
  4. We did not run the CSS or JS files through the optimizers, the CSS / JS still have the white spaces, comments in them.
  5. It is still possible to bring down the HTTP requests down by another 20-30 % easily.
  6. However, optimization , compression or minification doesnot go well with all the sites (depends upon hosting environment and site encoding). In one of my site the cyrillics went haywire after compression of javascript and CSS files.


What all else could we have done :

  1. Optimize CSS / JS files to remove the white spaces or comments (which decreases the size of css / js files by 10-40%).
  2. Use of the commercial components or other Joomla extensions such as page cache, Query cache, cssjscompress plugin. (which further reduces the loading time and http requests).
  3. Combine the CSS / JS files in one (which brings down the http requests).

Points to remember :

  1. Each site environment and setup is different and might need different approaches to optimize. Not all the options shall work perfectly on every site.
  2. Some components such as (page cache, Query cache, cssjscompress) might even break the site. That’s why you see the forums filled with queries, questions etc…
  3. Whatever you try on your website, always remember to back up site first, then backup the file you plan to edit or explore. If you miss this step, god help you.
  4. For the ease of calculation, remember that each module or image increase the http request by 1. For example, if you have 20 pics on a page, that means additional 20 http requests.
Now lets attempt to understand the basics and concept of speeding up joomla performance.

How and where to analyze Joomla performance?



  1. Go to http://analyze.websiteoptimization.com/ > put in your url > hit analyze > put the capctha code > wait for few secs > analyze > save the screenshot or make a pdf of it.
  2. There are other online analyzers also. But we all use http://analyze.websiteoptimization.com/ . why? Because everyone uses it :P

Which parameters are important ?

  1. HTTP requests
  2. Total size
  3. Number of HTML / CSS images
  4. Number of CSS / JS (scripts) files.
  5. Size of CSS / JS / HTML images.
  6. Check for duplicate JS files.
  7. Check for NOT FOUND items.
The above parameters will give a idea of what is wrong and what needs to be corrected. One can overlook the “Red Highlights” at the bottom of the result page. As its not possible to meet the stringent limits and most of them will go back to Yellow or Green once you have optimized your site.


First things first – What’s available in joomla?


Gzip

Joomla uses PHP to create the HTML pages that make up your website. These pages can be compressed using Gzip Compression. Most web servers support Gzip Compression, which can shrink your site’s pages by 70% to 90%. This will result in reduced bandwidth and faster page loads for your visitors. Remember, Gzip Compression will use more of your server’s processing power.
To enable Gzip Compression on your Joomla web site, go to your Global Configuration and go to the Server tab. Set GZIP Page Compression to Yes. To test your site after enabling Gzip check http://www.gidnetwork.com/tools/gzip-test.php and enter your website’s URL. The test will tell you if your pages are Gzipped or not.

Cache (system cache)

Cache works great and should be turned on, either from Global Configuration and another way is to enable the “System Cache” Plugin from Plugin Manager. Sometimes enabling Cache does not go well with cyrillics or special characters used.

What can be avoided to boost joomla performance?



Number of modules.

The less, the better. Do not overload your joomla with extra modules, because each module add to http request, may even load its own JS or CSS file.

Components :

If you have a choice between components, pick up the efficient one. Uninstall the components not in use.

Plugins :

Evaluate the benefits before installing any plugin. Disable or remove the unwanted plugins.
Example : Many people use JCE editor and during installation they also install the “JCE Utilities Plugin”.
Effect of JCE Utilities Plugin on Joomla :
  1. HTTP requests increased by 11.
  2. Loading Time increased by 50 Secs (@56 K.
  3. 3 additional Javascripts and 2 additional CSS files.
  4. Increase in total page size by 225396 bytes.
Do one really need cool effects by sacrifing site performance and speed?

Real time monitoring (live users – stats)

Turn off all Joomla Stats and just use Google Analytics to keep track of your users. Statistics are generated by using lots of queries to database, All the third party statsitics module / components are heavy on your joomla. Google analytics gives you what you really want to track your users and other relevant data.


Manual tweaking for a faster Joomla



1.    Template

  • Always try to have a lighter and simpler template. Put the templates through the analyzer before settling for one.
  • If changing template is no longer a option, then cut down on template based features, such as users tools, specialized login modules, unpublish such modules and if possible remove their reference from css also.

2.    CSS optimization

  • Take a backup of your css files and then run them through online optimizer http://www.cssoptimiser.com/index.php, It reduces the file size by 10-30 % and removes the comments, white space between the css code. Remember, after this step the css file will no longer be human readable, so always backup your copy.

3.    Java Scripts optimization

  • After saving a copy of your JS file, run the file through JS compressor at http://javascriptcompressor.com/. The results have varied for me, and not all the JS scripts like to be compressed. but no harm in trying this.

4.    HTML Images

  • Never ever ask the browser to scale a big picture for you. Use JCE editor to make autothumbs for you or upload your thumbnails manually. Resizing while downloading the picture means that the browser will download the full picture and then resize it for you.
  • For pictures, compress them, use Irfan View, or in photoshop use the option “save for web”. In any unoptimized thumbnail, it is possible to take away atleast 10KB each, just by opening and saving for web in photoshop.

5.    CSS Images.

  • These are the images loaded by your template and these images make up your template. If you have a simple template, the number of css images would be less.
  • If your template offers many options, such as color, style, module style, drop down menus option.  – then you need to manually edit the css files or your template’s index..php to load only the required scripts (menu styles) or images of the color scheme opted etc…. By default, half of the css images can be disabled or references removed without any serious effect on the layout or appearance of your template.

6. Clean Up Joomla

  • Remove unwanted / unused components, modules , plugins.
  • Check for leftover database tables of old components or plugins and drop those tables.
  • Optimize and repair the database tables. Use PhpMyAdmin for this.
  • If the analyzer report states any “Not Found” query. search and remove that query. Not Founds or 404 errors have bad effect on speed. The server/ browser is left thinking about how to deal with this missing item.

7. Combining CSS or JS files to reduce HTTP requests and file size.

Many options available for undertaking this task, a bit complicated.
  1. Minify – A Joomla independent Script – That works from the root directory of Joomla.
  2. Com_minify – A Joomla component that wrap the engine minify.

8. Using CSS sprites to reduce HTTP requests and picture sizes.

Here are two good articles with examples of implementing CSS sprite technique.
  1. http://websitetips.com/articles/css/sprites/
  2. http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/

Resources :
Joomla! Extension Directory Page for Site Performance.
Out of the listed extensions i found JA Compress plugin to be more friendly to use. It Supports two of the famous open source compression libraries Minify and SmartOptimizer to choose from and it searches and lists all the CSS / JS files right into the backend and further, allows selection / deselection for individual JS and CSS files right from your backend. This is of immense help when we want to exclude certain CSS or Javascript files from the compression. If it doesnot work by default for you, use the select / deselect feature to exclude non-template CSS or JS one by one, until it stablizes your site. Remember to clear cache (joomla! and your browser cache) each time, while setting up the plugin.
http://www.joomspot.net/how-to-speed-up-optimize-joomlas-performance.html

Artikel Terkait Joomla