ID: 49383
User updated by: olga at metacafe dot com
Reported By: olga at metacafe dot com
-Status: Feedback
+Status: Open
Bug Type: Performance problem
Operating System: Red Hat 3.4.6-10
PHP Version: 5.3, 6
New Comment:
Any PHP code does it.
The code:
<?php
echo "Hello!";
?>
The strace:
open("[path]/test.php", O_RDONLY) = 16
fstat(16, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
fstat(16, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
fstat(16, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
mmap(NULL, 82, PROT_READ, MAP_SHARED, 16, 0) = 0x2a9a8b4000
munmap(0x2a9a8b4000, 82) = 0
close(16) = 0
Previous Comments:
------------------------------------------------------------------------
[2009-08-31 11:48:20] [email protected]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2009-08-31 08:32:54] olga at metacafe dot com
Used the snapshot, nothing changed. Fstat() remains high.
------------------------------------------------------------------------
[2009-08-29 00:26:57] [email protected]
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-08-27 07:54:43] olga at metacafe dot com
Description:
------------
Hi,
We recently upgraded our web servers with PHP 5.3 and found out that
there are lots of empty fstat system calls. fstat is called 3 times on
each file open. This does not happen on PHP 5.2.9.
PHP 5.2.9 shows better results in benchmarking vs. 5.3.0, and I suppose
it's because of the fstat.
We're running Red Hat 3.4.6, Apache 2.0.59, PHP 5.3.0
Reproduce code:
---------------
Any code that loads PHP file.
Expected result:
----------------
Strace summary from 5.2.9
% time seconds usecs/call calls errors syscall
44.65 34.487815 159 217129 26 lstat
8.73 6.743625 170 39745 145 stat
8.23 6.355874 170 37466 18 open
8.21 6.345542 167 38091 close
7.99 6.170706 165 37410 fstat
Strace summary from 5.3.0
% time seconds usecs/call calls errors syscall
22.64 28.292541 301 93945 fstat
18.39 22.979631 312 73713 110 lstat
9.23 11.529433 311 37131 munmap
9.14 11.417404 306 37277 mmap
8.52 10.643572 306 34755 149 stat
Actual result:
--------------
Strace result.
I replaced full path by [path]
open("[path]/Flash.php", O_RDONLY) = 21
fstat(21, {st_mode=S_IFREG|0777, st_size=23902, ...}) = 0
fstat(21, {st_mode=S_IFREG|0777, st_size=23902, ...}) = 0
fstat(21, {st_mode=S_IFREG|0777, st_size=23902, ...}) = 0
mmap(NULL, 23902, PROT_READ, MAP_SHARED, 21, 0) = 0x2a971a2000
stat("[path]/Flash.php", {st_mode=S_IFREG|0777, st_size=23902, ...}) =
0
munmap(0x2a971a2000, 23902) = 0
close(21) = 0
lstat("[path]/VTalkNotification.php", {st_mode=S_IFREG|0777,
st_size=778, ...}) = 0
lstat("[path]/VTalkNotification.php", {st_mode=S_IFREG|0777,
st_size=778, ...}) = 0
open("[path]/VTalkNotification.php", O_RDONLY) = 21
fstat(21, {st_mode=S_IFREG|0777, st_size=778, ...}) = 0
fstat(21, {st_mode=S_IFREG|0777, st_size=778, ...}) = 0
fstat(21, {st_mode=S_IFREG|0777, st_size=778, ...}) = 0
mmap(NULL, 778, PROT_READ, MAP_SHARED, 21, 0) = 0x2a971a2000
stat("[path]/VTalkNotification.php", {st_mode=S_IFREG|0777,
st_size=778, ...}) = 0
munmap(0x2a971a2000, 778) = 0
close(21) = 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49383&edit=1