#49383 [Opn-Fbk]: Lots of empty fstat() calls slow performance

2009-08-31 Thread jani
 ID:   49383
 Updated by:   j...@php.net
 Reported By:  olga at metacafe dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Performance problem
 Operating System: Red Hat 3.4.6-10
-PHP Version:  5.3.0
+PHP Version:  5.3, 6
 New Comment:

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.




Previous Comments:


[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] j...@php.net

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   secondsusecs/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   38091close
  7.99   6.170706  165   37410fstat

Strace summary from 5.3.0
% time   secondsusecs/call   calls   errors   syscall 
 22.64   28.292541 301   93945fstat
 18.39   22.979631 312   73713  110   lstat
  9.23   11.529433 311   37131munmap
  9.14   11.417404 306   37277mmap
  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=49383edit=1



#49383 [Opn-Fbk]: Lots of empty fstat() calls slow performance

2009-08-28 Thread jani
 ID:   49383
 Updated by:   j...@php.net
 Reported By:  olga at metacafe dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Performance problem
 Operating System: Red Hat 3.4.6-10
 PHP Version:  5.3.0
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:


[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   secondsusecs/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   38091close
  7.99   6.170706  165   37410fstat

Strace summary from 5.3.0
% time   secondsusecs/call   calls   errors   syscall 
 22.64   28.292541 301   93945fstat
 18.39   22.979631 312   73713  110   lstat
  9.23   11.529433 311   37131munmap
  9.14   11.417404 306   37277mmap
  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=49383edit=1