I am focusing on a higher-traffic webserver farm serving dynamic PHP code including around 100 files of all demands. APC opcode cache is enabled, include_once_override is enabled, and that i have allotted 64MB ram towards the cache, yet after i strace an apache process I still view it open()ing and stat()ing many of these includes for each request that ought to be drawn from cache. I can tell in cache stats the cache has been populated and combined with one hundredPercent hitrate. Can anybody offer any insight?
Will, make sure you are using full pathnames to each use in the application. Per the APC documentation:
Be cautious altering this setting. This defaults to on, forcing APC to stat (check) the script on each request to find out if it's been modified. If it's been modified it'll recompile and cache the brand new version. If the setting is off, APC won't check, which often implies that to pressure APC to recheck files, the net server must be restarted or even the cache must be by hand removed. Observe that FastCGI web server designs might not obvious the cache on restart. On the production server in which the script files rarely change, a substantial performance boost could be accomplished by disabled stats.
For incorporated/needed files this method is applicable too, but observe that for relative path includes (any path that does not begin with / on Unix) APC needs to check to be able to distinctively identify the file. If you are using absolute path includes APC can skip the stat and employ that absolute path because the unique identifier for that file.
A great guideline for PHP would be to define a continuing that consists of the entire road to assembling your shed like so:
// Assumes __FILE__ is in the root of your project define('PATH_PROJECT', realpath(dirname(__FILE__)));
then make use of your includes like so:
include_once PATH_PROJECT . '/some/dir/file.php';
Thus you've still got the benefit of relative pathways, but they are really using full pathways.