phpvpsxcache

Configuring xcache cacher


I've just setup xcache on a vps server.

I have the admin section running and it is showing that xcache is running.

I am however a bit unsure about some of the settings - the documentation doesn't dwell very far into what each setting mean.

Notes that may be useful:

The version of php is:

PHP 5.4.21 (cli) (built: Nov 15 2013 10:15:53) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with XCache v3.0.3, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.0.3, Copyright (c) 2005-2013, by mOo

Question 1

The default settings from the installation has:

xcache.shm_scheme = mmap
xcache.mmap_path = /dev/zero

Why is mmap_path set to /dev/zero? doesn't this negate the whole thing? should it be set to a fixed file path.

Question 2

The other "size" settings are:

cache.size = 16M
xcache.slots = 8K
xcache.count = 1

Is there a methodical approach that can be used to work out the best configuration for these?

The stats are currently as such:

xcache summary

xcache summary continued

Note: I have seen it maxed out 100% usage previously.

Question 3

What does xcache.optimizer do?

The FAQ says

Currently only the "cacher" and "coverager" modules are implemented, tested and known to be working, the "optimizer" does nothing. it will be available only in XCache version 2, which is in an early development stage.

But i somehow appear to have XCache 3.0.3 installed o_O


Solution

  • The Xcache documentation is very poorly maintained, and I recently did my best to work through what is available, answering a similar question. I'll paraphrase a bit to hit your specific points.

    xcache.mmap_path

    If this is set to an empty or invalid path the cacher will turn off. I believe this should be a writeable directory. (On linux servers the default /dev/zero/ should work; on OSX this failed so I successfully used /tmp/xcache/ instead)

    Opcode cacher: size, count, slots

    The cacher also allows for a user controlled variable cache, with analogous settings and consequences.

    Optimizer

    This feature seems to be abandoned, or indefinitely under development — ignore it.