Thursday, September 6, 2012



XCache is awesome, at least for joomla. I've configured memcached on some high trafficed joomla sites but it didn't work well, even I saw some slowness.
Then I let the xcache to make a chance and it did ! I've seen reduce of load average and increase the speed of page loading using xcache.

Here's how configure xcache 2.x on centos 6.x.
Don't forget to :
- set a password for xcache-admin
- check the right module path in xcache.ini (zend_extension=/usr/lib/php/modules/xcache.so or zend_extension=/usr/lib64/php/modules/xcache.so)



yum install php-devel -y
cd /usr/src
wget http://xcache.lighttpd.net/pub/Releases/2.0.1/xcache-2.0.1.tar.gz
tar -zxf xcache-2.0.1.tar.gz
cd xcache-2.0.1
phpize --clean && phpize
./configure --enable-xcache --enable-xcache-optimizer
chown -R nobody /usr/src/xcache-2.0.1
sudo -u nobody make
make install
echo -e "[xcache-common]" > /etc/php.d/xcache.ini
echo -e "zend_extension=/usr/lib64/php/modules/xcache.so" >> /etc/php.d/xcache.ini
echo -e "[xcache.admin]" >> /etc/php.d/xcache.ini
echo -e "xcache.admin.enable_auth = Off" >> /etc/php.d/xcache.ini
echo -e "[xcache]" >> /etc/php.d/xcache.ini
echo -e "xcache.shm_scheme =        \"mmap\"" >> /etc/php.d/xcache.ini
echo -e "xcache.size  =               64M" >> /etc/php.d/xcache.ini
echo -e "xcache.count =                 1" >> /etc/php.d/xcache.ini
echo -e "xcache.slots =                8K" >> /etc/php.d/xcache.ini
echo -e "xcache.ttl   =                 0" >> /etc/php.d/xcache.ini
echo -e "xcache.gc_interval =           0" >> /etc/php.d/xcache.ini
echo -e "xcache.var_size  =            32M" >> /etc/php.d/xcache.ini
echo -e "xcache.var_count =             1" >> /etc/php.d/xcache.ini
echo -e "xcache.var_slots =            8K" >> /etc/php.d/xcache.ini
echo -e "xcache.var_ttl   =             0" >> /etc/php.d/xcache.ini
echo -e "xcache.var_maxttl   =          0" >> /etc/php.d/xcache.ini
echo -e "xcache.var_gc_interval =     300" >> /etc/php.d/xcache.ini
echo -e "xcache.readonly_protection = Off" >> /etc/php.d/xcache.ini
echo -e "xcache.mmap_path =    \"/dev/zero\"" >> /etc/php.d/xcache.ini
echo -e "xcache.coredump_directory =   \"\"" >> /etc/php.d/xcache.ini
echo -e "xcache.experimental =        Off" >> /etc/php.d/xcache.ini
echo -e "xcache.cacher =               On" >> /etc/php.d/xcache.ini
echo -e "xcache.stat   =               On" >> /etc/php.d/xcache.ini
echo -e "xcache.optimizer =           On" >> /etc/php.d/xcache.ini
echo -e "[xcache.coverager]" >> /etc/php.d/xcache.ini
echo -e "xcache.coverager =          Off" >> /etc/php.d/xcache.ini
echo -e "xcache.coveragedump_directory = \"\"" >> /etc/php.d/xcache.ini

# Check the admin page : http://localhost/xcache-admin/index.php
cp admin /var/www/xcache-admin -R



No comments:

Post a Comment