Thursday, March 24, 2011

HOWTO : MySQL and XCache performance tuning on Ubuntu 10.10

The following settings is for tuning the MySQL database performance on Ubuntu 10.10. It is well tested on Intel Xeon 4 core CPU x 2 and 8 GB RAM. It is also well tested on Drupal 6.2.

Step 1 :

sudo nano /etc/mysql/my.cnf

Change the values as the following :

[mysqld_safe]
nice = -5

[mysqld]
key_buffer = 384M
thread_cache_size = 384
max_connections = 500
table_cache = 1800
# If you have 8 cores CPU, the value should be 16 (no. of processor x 2)
thread_concurrency = 16
query_cache_limit = 4M
query_cache_size = 128M

[isamchk]
key_buffer = 64M


Step 2 :

sudo restart mysql

Step 3 (Optional) :

If you are using Hiawatha Web Server and PHP5, the following settings will further tune the performance also.

sudo apt-get install php5-xcache

Step 3a (Optional) :

sudo nano /etc/php5/conf.d/xcache.ini

Change the value of xcache.size as the following :

xcache.size = 64M

Step 3b (Optional) :

sudo /etc/init.d/php-fcgi restart

Step 3c (Optional) :

To test if it is working or not :

sudo php-cgi -v

If you can see the "with XCache v1.3.0, Copyright (c) 2005-2009, by mOo", your xcache is working.

That's all! See you.