Red Hat Bugzilla – Bug 623259
New include() / require() method in PHP 5.3 severely hurts performance
Last modified: 2012-09-25 05:13:26 EDT
Description of problem:
somewhere in the changeset from php 5.2 to 5.3 the access pattern for include(), include_once(), require() and require_once() changed.
Especially php 5.3 is doing the same fstat() call three times for every included file.
Version-Release number of selected component (if applicable):
- any 5.3 -
Steps to Reproduce:
1. install php 5.3
2. create a file test.php with "<?php include('test2.php') =>" in it
3. touch test2.php
4. run "strace php test.php" and see what happens for the include
many calls to lstat() and fstat()
only one fstat() call
We were actually hit by this bug when upgrading the php release on a webcluster (document root shared using gfs2). As the new php release does at least three times as much fstat() calls as 5.1.6 the load on the boxes immediately increased by 300% (from <= 10 to >= 30). Downgrading to php 5.2.14 fixed the issue.
I guess this isn't too bad for non-clustered filesystems, but as stat() has always been a bit slow on gfs doing it unneccessarily often means a severe performance hit.
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.
** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Thank you for your bug report. This issue was evaluated for inclusion
in the current release of Red Hat Enterprise Linux. Unfortunately, we
are unable to address this request in the current release. Because we
are in the final stage of Red Hat Enterprise Linux 6 development, only
significant, release-blocking issues involving serious regressions and
data corruption can be considered.
If you believe this issue meets the release blocking criteria as
defined and communicated to you by your Red Hat Support representative,
please ask your representative to file this issue as a blocker for the
current release. Otherwise, ask that it be evaluated for inclusion in
the next minor release of Red Hat Enterprise Linux.
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as an
exception or blocker.
Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
PHP upstream have closed the initial bug as "not a bug".
A new bug is open, and we will try to get this improved in a future PHP Version. But as this would require some interface breaks, it won't be possible to include it in older PHP Versions.
Notice: the use of an opcode cache, such as php-pecl-apc, slightly reduce the effect (only 2 "stat" calls, instead of 3 "fstat")