#27761 [Fbk->NoF]: Long list of require_once first slows down PHP than crashes Apache
| From: | iliaa@php.net | Date: | Tue, 20 Apr 2004 22:15:03 +0000 |
| Subject: | #27761 [Fbk->NoF]: Long list of require_once first slows down PHP than crashes Apache | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58487@lists.php.net to get a copy of this message | ||
ID: 27761
Updated by: iliaa@php.net
Reported By: wf at bitplan dot com
-Status: Feedback
+Status: No Feedback
Bug Type: Reproducible crash
Operating System: Windows XP
PHP Version: 5.0.0RC1
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2004-04-13 13:04:30] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2004-03-29 17:02:41] wf at bitplan dot com
Description:
------------
With the script below I generated some 200 PHP classes.
The profiling result for loading all these classes with some 25.000
lines of code is:
start:00:04:50.999346
stop :00:04:51.432091
The loading takes some 432 Milliseconds that ok for so many classes.
Doing the same with 60 classes in real code environment takes
from 3 to 25 secs before Apache crashes ...
awk '
BEGIN {
for (i=1;i<200;i++) {
class=sprintf("class%03d",i);
fname=class".php";
print "<?php" > fname
printf("class %s {\n",class) >>fname
printf(" public $somevar;\n") >> fname
for (j=1;j<60;j++) {
printf(" public function somefunction"j"() {\n") >> fname
printf(" }\n") >>fname
}
printf("} // %s\n",class) >>fname
print "?>" >> fname
close(fname);
}
fname="test.php";
print "<?php" > fname
print "include(\"profile.php\");" >> fname
print "profile(\"start\");" >> fname
for (i=1;i<200;i++) {
class=sprintf("class%03d",i);
classfname=class".php";
printf("require_once(\"%s\");\n",classfname) >> fname
}
print "displayProfile();" >> fname
print "?>" >> fname
close(fname);
}
'
profile.php has the following content:
<?php
/**
* get a Timestamp in string format
*/
function getTimestamp() {
$_time = gettimeofday();
return strftime("%X.", time()).$_time["usec"];
}
/**
* profile a given step
* @param the stepname
*/
function profile($step) {
global $profile_times;
$profile_times[$step]=getTimestamp();
}
/**
* display the profile
*/
function displayProfile() {
profile("stop");
echo "<BR>";
global $profile_times;
foreach ($profile_times as $_step=>$_time) {
echo $_step.":".$_time."<BR>";
} // foreach
} // displayProfile
?>
Reproduce code:
---------------
It said:
Please do not post more than 20 lines of source code.
If the code is longer then 20 lines, provide an URL to the source code
that will reproduce the bug.
Sorry - If I'd provide the URL I'd have to provide a server that may
crash any time.
A Zip File with the code can be made available by us
XPath.Class.php loading took up to 1.9 secs in our enviroment alone
when using the __Autoload feature:
be/estro/genepi/classUserManager.php:23:42:12.556828
com/bitplan/common/XPath.class.php:23:42:14.405958
Expected result:
----------------
Performance should be acceptable that is class loading should take less
than 300 millisecs.
Actual result:
--------------
Loading of a single class with 5600 lines of code takes 1.9 secs:
be/estro/genepi/classSession.php:23:42:12.422696
be/estro/genepi/classUserManager.php:23:42:12.556828 (250 lines of code
take approx 130 Millisecs ...)
com/bitplan/common/XPath.class.php:23:42:14.405958
5600 lines take 1.9 secs ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27761&edit=1