#38825 [NoF->Opn]: including a file is slower than expected
| From: | mark dot pearson at capita dot co dot uk | Date: | Mon, 27 Nov 2006 13:14:26 +0000 |
| Subject: | #38825 [NoF->Opn]: including a file is slower than expected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105475@lists.php.net to get a copy of this message | ||
ID: 38825
User updated by: mark dot pearson at capita dot co dot uk
Reported By: mark dot pearson at capita dot co dot uk
-Status: No Feedback
+Status: Open
Bug Type: Performance problem
Operating System: Windows Server 2003
PHP Version: 5.1.6
New Comment:
Running the benchmark script again on Platform 2 (Windows Server 2003
Xeon 2.80GHz processor) and the latest PHP5.2 snapshot gives the
following results:
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3624229431152
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.338228225708
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3370630741119
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3375468254089
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3394939899445
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3721809387207
D:\www\php5tests>D:\php5.2\php.exe -n benchmark.php
Elapsed time: 1.3796901702881
This still seems slow given that the same benchmark script gives an
average execution time of 0.52 seconds on Platform 1 (Windows XP
laptop) with the same PHP5.2 snapshot.
Previous Comments:
------------------------------------------------------------------------
[2006-11-21 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-11-13 15:15:44] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-11-08 14:59:26] mark dot pearson at capita dot co dot uk
I changed the path in my benchmark script to say both:
include './emptyfile.php';
and
include 'C:/www/php5tests/emptyfile.php';
and it made no difference whatsoever to the performance of the script,
contrary to what was suggested.
------------------------------------------------------------------------
[2006-10-18 14:18:56] iliaa@php.net
The include process is identical on all Win32 systems, any
slowdowns are likely to be related to either the drive speed
or the OS internals.
That said one of the reasons you are getting such bad
numbers is because you are using a partial path PHP needs to
resolve first. This compounded with ZTS mode makes things
very slow, change the include statement to use full paths
and you'll see much improved performance, not to mention
much more consistent numbers.
------------------------------------------------------------------------
[2006-09-14 11:25:24] mark dot pearson at capita dot co dot uk
Description:
------------
Having recently set up a Windows Server 2003 web development server it
has been found that file access by way of PHP 'include' is much slower
than it should be when compared to other platforms.
A small benchmark script (included) was run on four different platforms
(none of them production servers), using both PHP4 and PHP5 as described
below:
PLATFORM 1
----------
System:
Microsoft Windows XP
Professional
Version 2002
Service Pack 2
Computer:
Intel(R) Pentium(R) M processor 1600MHz
589 MHz, 512 MB of RAM
PHP versions tested:
4.4.4 and 5.2 2006-09-13 snapshot
PLATFORM 2
----------
System:
Microsoft Windows Server 2003
Enterprise Edition
Service Pack 1
Computer:
Intel(R) Xeon(TM) CPU 2.80GHz
2.80Ghz, 2.00GB of RAM
Physical Address Extension
PHP versions tested:
4.4.4 and 5.2 2006-09-13 snapshot
PLATFORM 3
----------
System:
Microsoft Windows Server 2003
Standard Edition
Service Pack 1
Computer:
Intel(R) Xeon(TM) CPU 3.00GHz
3.00Ghz, 3.50GB of RAM
PHP versions tested:
4.4.4 and 5.1.6
PLATFORM 4
----------
Fedora Core 4
Pentium 3 760MHz
256MB of RAM
4.3.11
The benchmark script was run 6 times on each platform.
Reproduce code:
---------------
benchmark.php
-------------
<?php
$tmp = split(" ",microtime());
$start = $tmp[0] + $tmp[1];
for ($i = 0; $i < 5000; $i++){
include 'emptyfile.php';
}
$tmp = split(" ",microtime());
$end = $tmp[0] + $tmp[1];
print "Elapsed time: " . ($end - $start) . "\n";
?>
emptyfile.php
-------------
<?php ?>
Expected result:
----------------
I would expect the benchmark.php script to run more quickly on both
PLATFORM 2 and PLATFORM 3 (both of which are high spec servers running
Windows 2003 Server) than on PLATFORM 1 (a Compaq nx7010 laptop running
Windows XP Pro) or PLATFORM 4 (a Dell Optiplex GX110 running Fedora Core
4).
Actual result:
--------------
The script completed more quickly even on PLATFORM 4 (Pentium 3 730MHz
256MB RAM) than on PLATFORM 2 and 3
The results are included below:
PLATFORM 1 - with no other apps running
=======================================
PHP 4.3.11
----------
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.87640404701233
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.89498400688171
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.98714590072632
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.92531800270081
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.94181489944458
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.92592406272888
PHP 5.2 (2006-09-13 snapshot)
-----------------------------
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.6999979019165
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.61439085006714
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.66567397117615
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.61945104598999
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.64544701576233
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.60436511039734
PLATFORM 2 - With no other apps running
=======================================
PHP 4.4.4
---------
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6818718910217
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6455881595612
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6652920246124
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.8808929920197
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.7031700611115
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6331689357758
PHP 5.2 (2006-09-13 snapshot)
-----------------------------
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5149850845337
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5081758499146
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5118081569672
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5036170482635
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.500696182251
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5246729850769
PLATFORM 3 - With no other apps running
=======================================
PHP 5.1.6
---------
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79046392440796
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79226303100586
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78908896446228
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79035115242004
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78956294059753
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78894019126892
PHP 4.4.4
---------
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2411949634552
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2386450767517
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2364308834076
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.23734998703
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2394840717316
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2390379905701
PLATFORM 4 - with no other apps running
=======================================
PHP 4.3.11 (cli) (built: Nov 15 2005 12:17:31)
----------------------------------------------
$ php -n benchmark.php
Elapsed time: 0.54825496673584
$ php -n benchmark.php
Elapsed time: 0.51459383964539
$ php -n benchmark.php
Elapsed time: 0.51424598693848
$ php -n benchmark.php
Elapsed time: 0.54676699638367
$ php -n benchmark.php
Elapsed time: 0.54855012893677
$ php -n benchmark.php
Elapsed time: 0.51129794120789
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38825&edit=1