apc.stat performance impact

The APC documentation says about the apc.stat option:

On a production server where you rarely change the code, turning stats off can produce a significant performance boost.

Did anyone ever benchmark this and cares to share the results?

Login to post comments

I never tried it, but this

intoxination - Thu, 2009-06-25 16:49

I never tried it, but this part here sends up a warning flag:

For included/required files this option applies as well, but note that if you are using relative path includes (any path that doesn't start with / on Unix) APC has to check in order to uniquely identify the file. If you use absolute path includes APC can skip the stat and use that absolute path as the unique identifier for the file.

So in other words if I have a module and do a:

include(mymodule.inc.php");

Then it will cause problems. This is kind of a common practice. Those includes would have to be changed to something like:
include (drupal_get_path("module","mymodule").'/mymodule.inc.php');

I can see where there would be a performance boost, especially depending on the number and size of modules you run, but I would definitely give it a thorough testing before going live with it.


Drupal 7

kbahey's picture
kbahey - Thu, 2009-06-25 21:49

We have not seen anything measurable from this settings so far.

Up until Drupal 6, we used:

<?php
include_once './includes/something.inc';
?>

However, in Drupal 7 we have this code in index.php:

<?php
define
('DRUPAL_ROOT', getcwd());
require_once
DRUPAL_ROOT . '/includes/bootstrap.inc';
?>

getcwd() returns the absolute path.

All the includes/requires after that use DRUPAL_ROOT

So we may see a benefit from that in Drupal 7, provided contrib modules use:

<?php
include (DRUPAL_ROOT . '/' . drupal_get_path("module","mymodule").'/mymodule.inc.php');
?>

Anyone has time for a benchmark?

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.


intoxination got it right. I

yhager's picture
yhager - Thu, 2009-06-25 18:12

intoxination got it right. I tested this once and got "realpath error" errors in the log file (can't remember the exact error), so had to turn it back off. There's a post by 2bit.com where he mentioned there was not a significant improvement in his tests (link?).