From:             remi
Operating system: GNU/Linux
PHP version:      5.4.7
Package:          Performance problem
Bug Type:         Bug
Bug description:Lot of fstat call during include

Description:
------------
Hi,

Each "include" statement call fstat 3 time, which can be "slow" in some
cluster environment (usgin GFS2 p.e.)

Already open as #49383 (but closed as "not a bug")

The fstat cache is only available inside "plain_wrapper".
A solution could be to expose a stream_cached_stat (in
_php_stream_wrapper_ops) and use it during open process (or a additionnal
parameter to stream_stat).

But this will introduce a important bc break.

Test script:
---------------
Trivial test code:
test1.php: <?php include('test2.php'); echo "done\n";
test2.php: irrevelant, can even be empty

$ strace php test1.php

Expected result:
----------------
...
open("xxx/test2.php", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=20, ...}) = 0
mmap(NULL, 20, PROT_READ, MAP_SHARED, 3, 0) = 0x7f0d595da000
munmap(0x7f0d595da000, 20)              = 0
close(3)    
...



Actual result:
--------------
...
open("xxx/test2.php", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=20, ...}) = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=20, ...}) = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=20, ...}) = 0
mmap(NULL, 20, PROT_READ, MAP_SHARED, 3, 0) = 0x7f0d595da000
munmap(0x7f0d595da000, 20)              = 0
close(3)    
...



-- 
Edit bug report at https://bugs.php.net/bug.php?id=63160&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63160&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63160&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63160&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63160&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63160&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63160&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63160&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63160&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63160&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63160&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63160&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63160&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63160&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63160&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63160&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63160&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63160&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63160&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63160&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63160&r=mysqlcfg

Reply via email to