Re: Re: Speed issues
| From: | Stephen | Date: | Thu, 15 May 2003 21:11:21 +0000 |
| Subject: | Re: Re: Speed issues | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19961@lists.php.net to get a copy of this message | ||
The problem you are experiancing is that your script is sending infomation
to the user, waiting for the reply, and doing this for EVERY output.
Basically, the time you are recording is actually the time taken for the
user to load the HTML code for that page. If you only want the time taken to
generate the page, you must use output buffering so that no infomation is
sent to the user BEFORE the entire page is completed. Output buffering is a
very useful features, and can help improve performance. It also allows for
gzip compression on the output, so less bandwidth per page is used. I
suggest looking in the php manual for output buffering
Stephen
----- Original Message -----
From: "Charles P. Killmer" <charlesk@netgaintechnology.com>
To: <php-windows@lists.php.net>
Sent: Thursday, May 15, 2003 6:54 PM
Subject: RE: [PHP-WIN] Re: Speed issues
I use the prepend and append directives in php to log to a file the
total script execution time of every php file. I use the same
getmicrotime functions to get down to the milliseconds that the page
excution takes.
What I am seeing is in these log files. Some times a single script will
take 30+ seconds but other times that same script takes <1 second. I
have even seen this in a script that has only a single if-then
statement. No other code exists in that script.
My only thought is that if a client gets a very slow connection maybe
that would cause a queue to form somewhere.
Charles
-----Original Message-----
From: The.Rock [mailto:chrisz@aurumtechnology.com]
Sent: Thursday, May 15, 2003 10:56 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Re: Speed issues
I'm on the same platform as you and sometimes when I refresh it takes a
couple of seconds to create the page. So I built this funtion to see how
long it really takes to create. I believe it is IIS serving up the
webpage that makes it takes so long. Put the start time at the beginning
of the script and the end time at the bottom (footer??)..Here ya go:
function getmicrotime() {
$bits = explode(" ", microtime());
return $bits[0] + $bits[1];
}
//this gets the start time it takes to run a script
$time_start = getmicrotime();
// lets get the ending time
$time_end = getmicrotime();
$total=$time_end-$time_start;
$total_format= number_format($total,4);
print "Created page in $total_format sec(s)";
"Charles P. Killmer" <charlesk@netgaintechnology.com> wrote in message
news:B141BE87473AA64FB24370C43CEA54BD29FC31@ngexbe1.my-netgain.com...
PHP 4.3.1 CGI mode
IIS 5.0
Windows 2000 Server
Every now and then I get scripts that take > 30 seconds to complete. The
same script usually takes < 1 second. Could a client on a VERY slow
connection be slowing this process down?
In a request process who handles queueing the data until the client can
download all of it? IIS or PHP or both?
Charles Killmer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php