Over the years spent in web page building and maintaining (since 1995, when published my very first webpage on a self-hosted SCO Linux box) a lot of information has been collected, settled down and at the end the best and most important tricks helping to make a website became fast and stable in the same time where surfaced. Despite the fact, that I wrote about this subject several times, it's a subject wich never looses his actuality.

When the idea for this tip began to shape up, I was wondering, if all this might be interesting for the average Joomla webmaster. All in all, they have access only to the last third of the settings - the ones related to Joomla itself. But then decided to release all the information. Might be useful. If you can't tweak your web server, at least you can try to get a hosting service which best matches the tips below, or you can ask your hosting company to match these recommendations.

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.

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. Unfortunately, the shared web hosting users are hard for the database performance tuning.
Then you can try to tune performance of MySQL through these parameters in my.cnfas 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.

PHP

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.

Joomla

There are 5 major variables you can easily tweak the performance of your Joomla website,

  • Enable GZIP Compression: Joomla supports the server side compression GZIP. Enabling GZIP can result in the significant performance improvements in 99% cases. The GZIP page compression setting is located on the server tab in the global configuration management.
  • Disable Useless Components: disable all useless components, modules and plugins and ensure they don't cost any resources of the server.
  • Minify CSS and JS: this is a manual process you should do for the CSS and Java Scrip files in the live environment. You can search many tools in Google for the ideas by minify CSS or minify JS. The Joomla extensions directory also lists some extensions which can minify these kind of files.
  • Skip Real Time Statistics: disable the components for real time statistics for your website can significantly improve the performance. Especially you don't have a specific requirement on it.
  • Caching: caching can be set on the either the site level or extension level. You can go to the Joomla administration page to check whether the global caching is enabled and go to site modules to check whether the caching for each module is enabled. With a well chosen extension, configuring caching it's straightforward. With a few simple configuration settings using my favorite tool, the generating time of my home page changed from 15 seconds to only 2 second.

After all, I recommend you using Page Speed for the performance tuning. It can generate a detailed report about your web page problems with the solutions and suggestions.

0
0
0
s2sdefault
Category: Configuration tricks