A Blog by DotJoomla
Performance and optimization of a websites is very important aspect. After a website is developed and deployed it must be optimized. So how it can be done?
Tools to identify
1. Google page speed - This tool analyze the website performance ina very user friendly way. It is available as an extesion for firefox and chrome.
2. Yahoo Yslow - It is available as an extension for both Firefox and chrome to identify the causes and suggestions to optimize the given website.
GZip is a method to compress the pages sent to the client by the server. The compression makes the server side work harder, but the compression is effective, and makes the pages much smaller. Enable this option by entering the global configuration in the server tab. In this tab, enable the option for Gzip Page Compression. If the option is not enabled, your Apache server should support it. Consult your hosting service.
Cache is another simple approach but is really effective for improving performance. Store cached data which is not expired in a well-defined time range. Cache can be run on the server or client side, and you can control both sides.
Server side cache - In case we are using cache on the server side, it takes time for the server to create the internet page which is sent to the client, meaning the HTML that the browser knows how to display. To enable the cache on the server side, you can do it easily in Joomla. Go into extensions->plugins. Search for system - cache, and make sure this plugin enabled. Then go into global configuration->system tab, and mark the cache as ON and Conservative.
# 1 YEAR <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> Header set Cache-Control "max-age=29030400, public" # 1 WEEK <FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" # 3 HOUR <FilesMatch "\.(txt|xml|js|css)$"> Header set Cache-Control "max-age=10800" # NEVER CACHE <FilesMatch "\.(html|htm|php|cgi|pl)$"> Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
The above declaration uses an Apache extension called mod_header. Alternatively, you can use another extension, called mod_expires and it contains other directives:
ExpiresActive On ExpiresDefault A0 # 1 YEAR <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> ExpiresDefault A29030400 # 1 WEEK <FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> ExpiresDefault A604800 # 3 HOUR <FilesMatch "\.(txt|xml|js|css)$"> ExpiresDefault A10800"
Note that the Gzip compresses HTML, and this one will compress the includes of the HTML (such as js, css and others). In addition, this method uses the mod_deflate extension of Apache. Make sure that you have this extension installed.
Minify & Merge
CSS and JS files are commonly shown line by line, which makes the programmer's life easier and makes building websites more effective, and allows for comments to debug. However, the browser, which is stupid, can use the same file with one line only while concatenating all lines to one line and without comments (which are useful only for human beings). This minify reduction saves file size and makes downloading much faster.
Compared to minify, merge reduction unifies all js files into a single js file, and does the same for css as well. Again, the sounds like a stupid action, because the download size is the same, but for each file request the server uses resources and downloading 10 files is not same as one file, because of the resources the server must invest in each request. The merge action saves resources and optimizes the client process of receiving data from the server.
There are a wide variety of tools being available on JED which can be used to perform all or any of the above.