Tuning Drupal on OS X Tiger

Using the devel module (http://drupal.org/node/31553) I discovered that the default mysql configuration parameters were slowing drupal down.
To see where your mysql is installed type at the command line:
which mysql
The selection of configuration files are in share /mysql; or if you followed the above instructions for installing MySQL, it should be in /usr/local/mysql/support-files.

The configuration file is in etc/mysql4; or if you followed the above instructions for installing MySQL, it should go in /usr/local/mysql but is not there by default. You can put it there by copying it in:
sudo cp /usr/local/mysql/support-files/my.large.cnf /usr/local/mysql/my.cnf.
Restart MySQL for the new settings to take effect.

To view the current variable settings for MySQL, from the terminal command line client type: mysqladmin -uroot -p variablesI opted for the "my.large.cnf" settings and halved the sql query times.

You can monitor MySQL through a pleasant user interface using MySQL Administrator, though it seems to expect my.cnf at /etc/my.cnf (it will still work, you just can't view the conf file).

I also discovered that I could roughly halve page load times by using Apache 2 instead of the stock Apache on Tiger.httpd -v to see what version you are running. I downloaded the php and Apache 2 from ServerLogistics: http://serverlogistics.com/downloads.php.

I am not sure I can recommend this for production sites as I do see some error diagnostics I haven't resolved yet. I didn't expect such a big difference with Apache2. Measurements with a system call profiler show that it does about half the read(2) system calls as Apache 1.3.

The overall impression I have from my benchmarking is that drupal pages require a lot of disk I/O to synthesize. Anything you can do to speed up or miminize (e.g. caching) is going to help. MySQL already has plenty of caching if a my.cnf files is being used. For the Apache/PHP part busy sites will need a php accelerator.

Additional resource:

 
 

Drupal is a registered trademark of Dries Buytaert.