|
Posted by C. (http://symcbean.blogspot.com/) on 01/07/08 13:01
On 4 Jan, 10:47, Gilles Ganault <nos...@nospam.com> wrote:
> On Fri, 4 Jan 2008 02:23:20 -0800 (PST), "_q_u_a_m_i_s's"
> >There is no easy way to optimize PHP,as with any other language you
> >have to know exactly what goes wrong with your scripts.
>
> That's the problem he has: If I had to investigate where things can be
> optimized in Linux + Apache + PHP + MySQL, what tool should I use?
>
> Thanks
None that any hosting company would let you run on a non-dedicated
server.....
Make sure you're running a opcode cache like PHPAccelerator.
Make sure you've got compression enabled for all non-image transfers.
Make sure you're using a Unix socket if MySQL is running on the same
host as the webserver.
Typically, the best performance benefits will come from tuning your DB
schema - meaning you should enable long query logging on the DBMS,
then suck out the data and anonymise the SQL (strip out the query
parameters so that 'SELECT * FROM widgets WHERE id=2334' becomes
something like 'SELECT * FROM widgets WHERE id=$p1') and look at the
queries with the highest sum of run times.
Analyse page rendering times - %T for apache custom logs will only
resolve to integer seconds but should be a starter for a badly
performing system - for preference use a proper E-2-E response time
tool like PastMon or Client Vantage and again identify the pages with
the highest hit rateXresponse times.
Use XDebug and KCachegrind to find out which bits of code are running
badly and refactor them.
C.
[Back to original message]
|