Re: Reducing load for LAMP app?



On Jan 7, 12:43 am, Gilles Ganault <nos...@xxxxxxxxxx> wrote:
On Sun, 06 Jan 2008 15:54:17 -0500, Jerry Stuckle

<jstuck...@xxxxxxxxxxxxx> wrote:
It's already in seconds.

OK. I can live with the trailing E :-)

Looks like a very busy host:
======
load average: 61.88, 51.08, 74.30
Tasks: 476 total, 7 running, 467 sleeping, 0 stopped, 2 zombie
Cpu(s): 78.8% us, 18.7% sy, 0.0% ni, 0.7% id, 0.3% wa, 0.5% hi,
1.0% si
Mem: 1015484k total, 993344k used, 22140k free, 76920k
buffers
Swap: 514040k total, 101032k used, 413008k free, 208496k
cached


You do not have enough free RAM. If this was a peak time the this
could be ok...but looking at the numbers:
- you have 1Gb of RAM, from that 22Mb are free, and 76Mb are used for
file-buffers(opened files). The rest are taken by applications.
- the swap is used, you should not have any data swapped if you need a
FAST webserver. Keep everything in ram..

- your load avg is 61 ??? this is waaay over. the load avg should stay
below 10..at least from what i saw while working.
- 78%$ of the cpu time is spent in user mode (apache & webalizer in
your case). Try to look for more apache ways to optimize this.

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
10685 ze-card 19 19 984 736 724 R N 93.3 0.0 5671m webalizer

webalizer should not be in this list, it should start/stop quickly.

32072 nobody 9 0 16932 15M 12156 S 6.0 0.3 0:01 httpd

Are your scripts memory intensive? i do not know how much an usual php
process takes, but 14Mb its a lot of data for one page-request.

32196 nobody 9 0 16224 14M 12144 S 3.5 0.3 0:01 httpd
1868 nobody 9 0 16284 14M 12620 S 3.1 0.3 0:00 httpd
2136 nobody 9 0 16080 14M 12164 S 2.5 0.3 0:00 httpd
32205 nobody 9 0 16300 14M 12136 S 2.3 0.3 0:00 httpd
32231 nobody 9 0 16316 14M 12172 S 2.3 0.3 0:00 httpd
32124 nobody 9 0 16620 14M 12184 S 1.9 0.3 0:01 httpd
======

If I understood what I read on top and vmstat, this host has enough
RAM, but the CPU is heavily used (load average much higher than 1),
with lots of sleeping processes.

I have to find out if it's just PHP or MySQL, or even the network that
is the bottleneck.

Try to use xdebug & cachegrind to see what is wrong with your scripts,
and determine some points where to create some "caching points" so
that redundant data is not re-calculated over and over and over
and......

If the webpages can be cached, then cache them, do not regenerate them
everytime

.



Relevant Pages

  • Re: Reducing load for LAMP app?
    ... Looks like a very busy host: ... PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND ... RAM, but the CPU is heavily used (load average much higher than 1), ...
    (comp.lang.php)
  • FC3- System Takes Minutes To Open Any Application
    ... Load Average is mostly 2+, RAM also get used free soon. ... Another strange thing is when I log off from KDE I always see my ... Device Boot Start End Blocks Id System ...
    (Fedora)