[phpa] Re: IMPORTANT comment concerning Vhost phpa enable

As paul says, optimising queries is a good idea. MySQL is good at getting 
the *wrong* join order, even with the recent releases. And this even after 
running an analyze to update the key distribution stats. So log your 
queries, run the outside of php and see if modifying the join order makes a 
difference. You can force join order by using join key words rather than 
just ','. 

Then, are you running any queries where you can cache results. If you are, 
then consider not just caching the query result set, but instead, caching 
the processed result. So say you're running queries to lookup a list of 
country names, and then generating html to populate a popup control. Rather 
than caching the country query result set and still generating the html 
code each time, cache the html text in shared memory and just look that up.

Depending on your application, and even if the data in the db is changing 
from people running inserts, returning stale data may be acceptable. Say 
you were running a BBoard application, with continual inserts and 5 selects 
per second on a given dataset. Unless a lookup was by someone who had just 
done a post, you might get away with doing just one select query per second 
and caching the data for the rest of that second. Or caching the HTML that 
you generated from that query. You might vary the cache time depending on 
how busy the server is.

So someone might not see the latest post(s), but that happens anyway with 
the natural delays that happen on the internet.  An alternative would be to 
batch inserts together, building them up in shm. Then because no inserts 
had really happened, your select caching would know this and for that 
reason not do a select. At some point a select would trigger the inserts to 
happen if they had been waiting for more than a certain period.  But you 
could lose the inserts this way if your machine went down, and a select 
would be delayed while it flushed the inserts. So I'd favour always doing 
the inserts but skipping selects.  

Nick


------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts: