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.


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


- 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
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/ 9 0 50.08 K 7.51 K 6 M 2049 6176769 1 m 32 m
php#0 1 /home/lsnet/public_html/ 73 0 79.31 K 13.01 K 3 w 2049 22102019 23 s 31 m
php#0 2 /home/lsnet/public_html/ 9 0 779.38 K 122.45 K 2 w 2049 8372227 1 m 32 m
php#0 3 /home/adumbral/public_html/ 10 0 6.34 K 872.00 b 2 Y 2049 20512773 3 m 30 m
php#0 4 /home/lsnet/public_html/ 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.