ID:               27240
 User updated by:  akoerni at rocketmail dot com
 Reported By:      akoerni at rocketmail dot com
 Status:           Open
 Bug Type:         Performance problem
 Operating System: Windows 2000
-PHP Version:      4.3.4
+PHP Version:      4.3.4/5.0.0b4
 New Comment:

Changed Version so that it is correct now.


Previous Comments:
------------------------------------------------------------------------

[2004-02-13 08:20:42] akoerni at rocketmail dot com

Description:
------------
This bug was postet at apache.org as Bugzilla Bug 26912 but the guys
there told me to post here...



I wrote a small PHP script to display a simple table fetched from MySQL
on my system. The response time from sending a request until the page
is displayed is EXTREMELY slow 5-7 seconds (!) even for tables with
only 27 rows. In this time 

period the hard disk is accessed continously (writing sound). The more
rows are added, the slower it gets (each row ~200ms).



I installed the same script at
(http://akoerni.lima-city-webspace.de/list.php?EinsatzID=1) so you can
get an idea. At this site it works as fast as usual (a 

few milliseconds) if you do not consider request time.



It is **NOT** a database/query issue. MySQL response time is some
milliseconds (tested with MySQL Control Center, mysql.exe, PHP
script).

It is **NOT** a latency issue. (Installed on localhost. Redirected
above mentioned website to my local database resulting in good
performance).



The problem is reproduceable with the following configuration:



Windows 2000 SP4      (AMD 2400+, 512MB)

Apache 2.0.48         (apache_2.0.48-win32-x86-no_ssl.msi)

PHP 4.3.4 AND 5.0.0b4 (php-4.3.4-Win32.zip / php-5.0.0b4-Win32.zip)

MySQL 4.0.17          (mysql-4.0.17-win-noinstall.zip)



Using Apache 1.3.29 on together with PHP 4.3.4 results in good
performance! (It does not work with 5.0.0b4, however). I installed each
version of Apache as service to all users. The httpd.conf is the
default config + 3 PHP specific 

lines. The php.ini is the php.ini-recommended file with adaptions for
the extension_dir and the uncommented line "extension=php_mysql.dll"
(PHP 5).

Reproduce code:
---------------
PHP code for the creation of the HTML table follows:



function xmicrotime($name, $starttime) {

  $now = explode(" ", microtime());

  $before = explode(" ", $starttime);

  $mseconds = $now[0] - $before[0]; 

  $seconds = $now[1] - $before[1]; 

  echo $name . " took " . $seconds . " sec. and " . $mseconds . "
ms.";

}



$i = 0;

$start= microtime();

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

   $i++;

   echo "\t<tr class=\"";

       if ($i%2 == 0) {echo "GERADE";}

         else {echo "UNGERADE";}

   echo "\">\n";



   echo "\t\t<td class=\"datum\">" .$line[Datum]. "</td>\n";

   echo "\t\t<td class=\"zeit\">" .$line[Zeit]. "</td>\n";

   echo "\t\t<td class=\"kanal\">" .$line[Kanal]. "</td>\n";

   echo "\t\t<td class=\"betriebsart\">" .$line[Betriebsart].
"</td>\n";

   echo "\t\t<td class=\"an\">" .$line[An]. "</td>\n";

   echo "\t\t<td class=\"von\">" .$line[Von]. "</td>\n";

   echo "\t\t<td class=\"ereignis\">"
.htmlspecialchars($line[Ereignis]). 

"</td>\n";

   echo "\t\t<td class=\"vermerk\">" .htmlspecialchars($line[Vermerk]).


"</td>\n";



}

xmicrotime("total_time:", $start);

Expected result:
----------------
The script should not take longer than 200ms.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27240&edit=1

Reply via email to