From: olga at metacafe dot com
Operating system: Red Hat 3.4.6-10
PHP version: 5.3.0
PHP Bug Type: Performance problem
Bug description: Lots of empty fstat() calls slow performance
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 bug report at http://bugs.php.net/?id=49383&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49383&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49383&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49383&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49383&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49383&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49383&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49383&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49383&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49383&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49383&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49383&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49383&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49383&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49383&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49383&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49383&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49383&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49383&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49383&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49383&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49383&r=mysqlcfg