Bug 623259 - New include() / require() method in PHP 5.3 severely hurts performance
Summary: New include() / require() method in PHP 5.3 severely hurts performance
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: php   
(Show other bugs)
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Joe Orton
QA Contact: BaseOS QE - Apps
Keywords: RHELNAK
Depends On:
TreeView+ depends on / blocked
Reported: 2010-08-11 17:55 UTC by Andreas Rogge
Modified: 2012-09-25 09:13 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-09-25 09:13:26 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
PHP Bug Tracker 63160 None None None 2012-09-25 08:11:58 UTC

Description Andreas Rogge 2010-08-11 17:55:23 UTC
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 -

How reproducible:

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
Actual results:
many calls to lstat() and fstat()

Expected results:
only one fstat() call

Additional info:
See also:

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.

Comment 2 RHEL Product and Program Management 2010-08-11 18:18:44 UTC
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. **

Comment 3 RHEL Product and Program Management 2010-08-18 21:27:38 UTC
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.

Comment 4 Suzanne Yeghiayan 2011-03-28 21:11:47 UTC
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.

Comment 5 Remi Collet 2012-09-25 09:13:26 UTC
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")

Note You need to log in before you can comment on or make changes to this bug.