Re: Re: Strange slowdowns in PHP
| From: | Manuel Lemos | Date: | Mon, 27 Feb 2006 22:32:21 +0000 |
| Subject: | Re: Re: Strange slowdowns in PHP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231165@lists.php.net to get a copy of this message | ||
Hello,
on 02/27/2006 07:22 PM William Lovaton said the following:
>>> Looking at the log I get the following information:
>>> - Execution time: 29.3 secs
>>> - Request started at: 11:08:06 AM
>>> - Request ended at: 11:08:35 AM
>>> - The functions that got executed were (time, class::method, duration):
>>> - 11:08:06, GraficoMaterno::alturaUterina, 0.009499
>>> - 11:08:06, GraficoAlturaUterina::session_start, 0.001259
>>> - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613
>>> - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186
>>>
>>> The last record in the profile (GraficoAlturaUterina::sendImage)
>>> corresponds to the last couple of lines of code in the script which are:
>>> imagepng($image);
>>> imagedestroy($image);
>> If you are generating a large image, it may take some time to flush the
>> output buffer to serve to the user browser.
>
> The image is small. And as you can see in the profile, that operation
> took 0.02 secs, so it is very fast. Unless those operations are being
> executed in asynchronous mode (which I don't think they are) this might
> be the responsible of the slowdown.
>
> I have to note that this problem is happening on random pages which also
> generates regular HTML, this is not something particular to images. So
> my guess would be that the problem is somewhere in the session code.
What I am trying to tell you is that generating data and serving it to
the user browser are to separate steps. The output that your PHP script
produces goes to a buffer that needs to be flushed after the script
ends. I suppose you are serving data to users with slow connections.
That would explain why you have the problem some times but not always.
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/