Hosting Tutorial & Guide

Joomla Optimization - How to Optimize Joomla in Web Hosting

updated on Oct 25, 2014
Joomla Optimization - How to Optimize Joomla in Web Hosting The most of performance complaints about the web hosting are the result of incorrectly configuration, but not the poor performance of the network and web servers. From my perspective it's the same case for Joomla websites.

You are allowed for limited performance tuning in a web host, but it is no reason why a virtual or dedicated server are not correctly optimized for the better loading speed. Today I introduce the performance optimization in all the web hosting, VPS and dedicated servers, including Apache, MySQL, PHP and Joomla configuration.

Joomla Optimization in Web Hosting

According to the limited server permission, the optimization of a Joomla site in a web host is limited on the site itself. To complete this process, you may need to get assistance from a monitoring tool to get the performance tuning statistics, then taking some of the tips below against your site correspondingly.

Enable GZIP
Joomla supports the server side compression GZIP. Enabling GZIP can result in the significant performance improvements in the 90% cases. The GZIP page compression setting is located on the server tab in the global configuration management.

Enable Caching
Caching is the first thing you should consider when you try to gain a better website performance. If caching is not enabled, every time a visitor goes to a page on your site, the script makes a number of queries to the database to load the content and some other things. Those queries take time to be executed, so the page will be loaded slowly.

To resolve the issue, you can use the built-in caching provided by Joomla by default. There are many caching extensions available on the Internet, but the Joomla default caching is good enough. It can be easily enabled through Joomla settings. It is recommended that you use only this caching in order not to slow down your site with too many unnecessary extensions.

Optimize Templates & Extensions
You may have installed many charming templates to make your Joomla site look good and a large number of extensions to give your site much more functionality. Most of the time, when you change a new appearance or no longer use a module, you still let the old templates and extensions installed in the site. Maybe you don't delete them because they might come into use someday, but you should know that they keep affecting the performance of your site greatly.

In this case, you'd better take a look at all of your installed templates and extensions and then delete those unused or even those unnecessary. Some people may think that simply deactivating them can eliminate their bad effect to the site, but that is not true. Even if you deactivate them, they still slow down your site and leave your site open to vulnerability.

For the templates and extensions that are useful for your site, make sure that you have updated them to the latest versions, as the bugs and issues are fixed and even some new features are added. Using new versions certainly enables you to have a better experience.

Optimize Images
One of the easiest things to do to speed up your Joomla site is to optimize the images in your site. For this aspect, you should avoid using large, slow loading images. For the existing images in your pages, you can choose to resize and compress them to make them smaller thus load faster.

To optimize these images, you can either use a Joomla extension or an easy-to-use software. If you do in the former way, we recommend Content Optimizer which helps you optimize images by caching and resizing them. Or if you choose the latter way, you can use a quality software like Adobe Fireworks which gives you the highest compression with the least image degradation.

Optimize CSS & JavaScript
There is a setting in Joomla configuration called gZip compression. It allows all the CSS and HTML to be compressed on the server, and a much smaller packet of data is sent to your visitor and then uncompressed by the browser. It seems that the compression is a hard work, but it will certainly make your pages load faster.

What you should note here is that this might increase the load of your site on the server. Therefore, after enabling gZip compression, you should keep monitoring your site closely to check whether you are overloading your server. If the setting breaks your site, you can just change it back and give up compression.

For JavaScript, each library that you load inevitably makes your site slower. To get rid of this issue, our advice is to stick to only one JavaScript library and use it for all of your installed extensions.

A CDN content delivery network is a large distributed system of servers deployed in multiple data centers across the Internet. It is designed with the purpose to deliver high performance for end users, so going for a CDN is a reasonable option to improve the performance of Joomla sites.

If you have little technical skills, you may encounter some troubles in using a CDN. Our suggestion is that you'd better sign up with a web host which provides this service within the shared web hosting package as well as complete technical support for it. Personally, we recommend BlueHost, not only because this company is among the few web hosts who have CDN service, but also for it offers 24x7 responsive support via phone, live chat and email.

Joomla Optimization in VPS & Dedicated Server

In addition to the steps above, when you are using a VPS or dedicated server, you have more choices to do for Joomla loading speed than a web host.

Optimize Apache
The web server should not swap because it significantly adds the latency of every request beyond a point that users consider as fast enough. You should control the MaxClients configuration that your web server doesn't swap too many children when it begins to swap. The suggestion is that determine the size of the average Apache process by looking at the process list through some tools such as TOP, analyzing the total available memory, and reserving some memory for other processes.

Apache is configured by httpd.config . The parameters as below are important for child process configuration.
  • MaxClients: the max number of child processes to be created. The default value is 256. It means that there are up to 256 HTTP requests can be processed at a same time. Any more requests will be queued temporarily.
  • StartServers: the number of child processes to be created on the application start, defaults to 5.
  • MinSpareServers: the number of idle child processes even there is no request at a moment. The appropriate number of this configuration is the balance that it can both reduce the time of web server to start a new process for the request and save the memory. My suggestion is, set it to 2 for your website has less than 300 page views daily, 4 for less than 600, and 8 for less than 1200.
  • MaxRequestsPerChild: the number of HTTP requests that a child process can handle before it's terminated. Zero means that the child process is never terminated. The appropriate value is 100 (small site), 250 -500(medium site) and 1000 (large site).
  • KeepAlive: as in the old HTTP design, the web server creates a separate connection with the client for each request. To decrease the overhead connections, the keep alive HTTP header was used. This header asks the web server to reuse the same connection for multiple requests per one client. So turning on KeepAlive significantly improves the website performance at most time.
  • KeepAliveTimeout: how long the connection is to be kept alive in seconds. The time contains both the content generation by server and the acknowledgement by the client. If the client doesn't acknowledge on time, it has to create a new connection. The suggested configuration is 5-10 rather than the default 15 seconds.
  • MaxKeepAliveRequests: the connections the will be terminated when the number of requests is reached. Try to keep this configuration to a high value about 80% of MaxClients.
Read more about Apache performance tuning.

Optimize MySQL
The main performance bottlenecks of Joomla or other CMS is the improperly configuration of MySQL database server. The first step for database optimization is to estimate MySQL memory consumption by Joomla different components, modules and plugins that you're using for the website. How database is depended on, how many database queries are used, and how many tables are required for them. Then you can start to tune MySQL performance through these parameters in my.cnf as following,
  • querycachelimit=2M, querycachesize=64M, and querycachetype=1: query caching is a database server level variable. I found these settings are generally best for the virtual or dedicated server with 512M RAM or more.
  • key_buffer=128M: it's the key buffer shared by all MySQL clients on the server. The large number variable is recommended especially for the tables with unique keys.
  • sortbuffersize=512K, readbuffersize=1M, readrndbuffer_size=512K: these variables are for clients. With these configuration, each active MySQL client uses 2MB RAM for buffer so that it almost needs 100MB if there are 50 clients. Configuring too much on these buffers is actually worse than the little. Otherwise the server may be killed in the memory swapping.
  • thread_concurrency=2: set 2X of the processors in the machine for best performance.

Optimize PHP Configuration
PHP is a high performance programming language but there are a bunch of things on the optimization rather than the code execution speed. The PHP optimization involves a lot of factors not only source code relevant. This is the reason why tuning PHP websites requires the good understanding of how PHP executes in relation to all the other subsystems. As it's a large topic on PHP performance tuning, I recommend you reading through this article when you have time.


Any optimizations are based on the case that you're using a reliable hosting company. When you're experiencing downtime regularly, or having slowdown only at the peak time, that may not be a topic of optimization, but high possible an issue of your hosting provider. In this case, we recommend you moving to one of the best Joomla hosting providers before wasting your time on unused optimization.