Open Source Content Management Framework

Performance tuning

  1. High-performance Midgard setup
  2. MidCOM Configuration
  3. PHP Caches
  4. MySQL Tuning
    1. Quick and Dirty things
    2. More about it
  5. Tuning Apache

This document is by no means complete, also all tuning is dependent on your specific situation

For high-volume public sites Squid is highly recommended in addition to the techniques below.

view_midgard-cache-setup.png

High-performance Midgard setup

MidCOM Configuration

This applies to MidCOM 2.6 without midcom-template, if you haven't upgraded you should seriously consider it

Disable scheduling (use staging-live if you really need it) and logging, in the hosts code-init add the following lines:

$GLOBALS['midcom_config_local']['log_level'] = 0;
$GLOBALS['midcom_config_local']['metadata_scheduling'] = false;
$GLOBALS['midcom_config_local']['metadata_approval'] = false;

PHP Caches

Install Turck MMCache (all versions of FS-MidCOM get advantage from this), since there is no PECL package for this you must look for a package for your distro or hand-compile.

Install Memcached and the corresponding PHP extension (ACLs in MidCOM 2.6 can take advantage of this). Install the PHP extension with:

pecl install memcache

After which you must install and configure (and secure) the Memcached itself.

Example configuration in midcom.conf:

$GLOBALS['midcom_config_site']['cache_module_memcache_backend'] = 'memcached';
$GLOBALS['midcom_config_site']['cache_module_memcache_backend_config'] = Array('host' => 'localhost', 'port' => 11211);

MySQL Tuning

Quick and Dirty things

in my.cnf make sure query cache is enabled:

query_cache_type = 1
query_cache_size = 10M
query_cache_limit = 1M

There are other caches to consider as well, see the example my-xxx.cnf -files, usually included in the install. Also tuning the caches to your specific situation may require some work.

Especially if your filesystem is slow for some reason, make sure the atime doesn't get stored for MySQL database files, if you have MySQL datadir as it's own partition (you should), then in /etc/mtab add noatime to the mount options and remount. If not you can use chattr to set the flags on the files via the following command:

chatttr +A -R /path/to/mysql

Which you (probably) must re-run each time new tables or databases are added (maybe you should add it to cron ?)

More about it

Here's a few articles on optimizing mysql, O'Reilly has a good book about it as well.

Tuning Apache

If you seem to collect a lot of apache processes that hog memory try lowering the MaxRequestsPerChild to kill them of faster. Basically this happens because some things take more memory than others and apache children do not like to free memory they have already got for themselves, they just re-use it, so if these memory intensive operations hit always different children then you suddenly have a lot of memory reserved but not really used and the longer the children stay around the longer they reserve that memory.

Google is your friend but here are some pointers

Tagged
performance
squid
memcached
mysql
tuning
apache
Designed by Nemein, hosted by Anykey