Implementing php5-xcache

Of the three "free" php opcode caching schemes APC, eAccelerator and Xcache, the latter had an installable package and appeared simplest to implement. I tried it on my local workstation first (always a good idea) and it came up with little difficulty.

apt-get install php5-xcache

Now generate the password.

echo -n "my_password" | md5sum -

Modify the username and password in /etc/php5/apache2/conf.d/xcache.ini

Hang the web code someplace easy to get at.

cp -a /usr/share/xcache/admin /var/www/xcache-web

Restart Apache.

/etc/init.d/apache2/restart

Point browser to http://localhost/xcache-web/

It works!

Now repeat on the "real" web server.

The OS version is a little moldy and the package php5-xcache installs but the configuration file is missing and the web pages don't work. Simple matter to upload those from the working version on my workstation.

It works! (Sort of.) Within seconds the default 16MB of opcode cache is exhausted. Edit the config file, bump the cache to 256MB and... It's a start.

XCache 1.2.0 Administration

Help » Statistics List PHP List Var Data

Caches:


- Slots Size Avail % Clear Compiling Hits Misses Clogs OOMs Protected Cached Deleted GC
php#0 8.00 K 256.00 M 424.00 b
 
 
no 31,031 3,947 394 2,567 no 1,380 0  
Free Blocks:
php#0 size
offset
424.00 b
256.00 M
 

php Cached


Cache entry Hits Refcount Size SrcSize Modify device inode Access Create
php#0 0 /home/lsnet/public_html/downtowngalax.com/sites/all/modules/ed_classified/ed_classified_settings.inc 9 0 50.08 K 7.51 K 6 M 2049 6176769 1 m 32 m
php#0 1 /home/lsnet/public_html/drupal.ls.net/includes/actions.inc 73 0 79.31 K 13.01 K 3 w 2049 22102019 23 s 31 m
php#0 2 /home/lsnet/public_html/downtowngalax.com/includes/common.inc 9 0 779.38 K 122.45 K 2 w 2049 8372227 1 m 32 m
php#0 3 /home/adumbral/public_html/mydllurth.com/index.php 10 0 6.34 K 872.00 b 2 Y 2049 20512773 3 m 30 m
php#0 4 /home/lsnet/public_html/drupal.ls.net/includes/bootstrap.inc 73 0 247.06 K 36.87 K 2 w 2049 22102021 23 s 31 m

Good reason to use shared code and a Drupal "farm". I may try 512MB tomorrow but I am beginning to feel the pinch on memory. MySQL is now hogging the CPU and UTF-8 makes a mockery of reading /var/log/mysql/mysql.log. That passes.

Now it is time to implement some performance measuring tools.