Re: RE: optimizing PHP for microseconds
| From: | Tommy Pham | Date: | Fri, 26 Mar 2010 06:05:36 +0000 |
| Subject: | Re: RE: optimizing PHP for microseconds | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-303496@lists.php.net to get a copy of this message | ||
On Thu, Mar 25, 2010 at 8:15 PM, Robert Cummings <robert@interjinn.com> wrote:
> Daevid Vincent wrote:
>>
>>
>>>
>>> -----Original Message-----
>>> From: Robert Cummings [mailto:robert@interjinn.com] Sent: Thursday, March
>>> 25, 2010 7:16 PM
>>>
>>> Daevid Vincent wrote:
>>>>
>>>> If I have to wait 3 seconds for a page to render, that wait
>>>
>>> is noticeable.
>>>>
>>>> Dumb users will click refresh, and since (unbelievably in
>>>
>>> this day and age)
>>>>
>>>> PHP and mySQL don't know the user clicked 'stop' or
>>>> 'refresh', and
>>>> therefore mySQL will execute the same query a second time. That's an
>>>> entirely different thread I've already ranted on about.
>>>
>>> You may find the following enlightening:
>>>
>>>
>>> http://www.php.net/manual/en/function.ignore-user-abort.php
>>>
>>> http://www.php.net/manual/en/function.connection-aborted.php
>>>
>>> http://www.php.net/manual/en/function.connection-status.php
>>>
>>
>> Except there is no way to tell mySQL "cancel that last request/query".
>> Well, no graceful way.
>>
>> We actually have a script that runs on a crontab and seeks and destroys
>> "long running" queries. As you may have guessed, just because a query
>> takes
>> a long time, it's difficult to know if it's actually hung or just really
>> taking that long. So we do some smarts to compare against others and see
>> if
>> it seems like the same one and stuff like that. Not great, but sure stops
>> the load from shooting through the roof.
>>
>> Again, not going into the rant I've done before. Look in the archives
>> 2009-06-02 for "Why doesn't mySQL stop a query when the browser tab is
>> closed" for that thread and even more indepth info on the
>> mysql@lists.mysql.com archives (same date and subject).
>
> That's a good point about MySQL, and in fact PHP would probably keep running
> too until MySQL returned.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
What about 'SHOW FULL PROCESSLIST' and look through the 'INFO' for
that last matching query statement and kill the process?