FreeBSD 6.2-STABLE && apache 2.2.4 = bad performance. Help!
cswiger at mac.com
Wed Jul 18 23:01:31 UTC 2007
On Jul 18, 2007, at 3:12 PM, Michael Vaughn wrote:
> Hello everyone,
> I am contacting -performance, -questions, and -hackers in the hope
> helps me troubleshoot a problem with FreeBSD 6.2 and apache 2.2.4
Please don't cross-post between multiple FreeBSD lists; pick the most
[ ... ]
> Right after starting apache, the loads on the server will climb to
> and the application will become unacceptably slow. This will go on
> until few
> users are using the said application. (note: other servers running
> FreeBSD versions on dual cpus running the same code don't exhibit this
> system% problem) top shows more than 60% of the CPU time is spent
> on system:
> CPU states: 19.9% user, 0.0% nice, 73.7% system, 1.7% interrupt,
> 4.7% idle
> Mem: 398M Active, 2226M Inact, 253M Wired, 202M Cache, 214M Buf,
> 567M Free
> The apache processes look like:
> PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
> 56882 www 1 103 0 139M 17516K select 0 0:03 12.66% httpd
> 56862 www 1 100 0 139M 21168K CPU2 6 0:06 11.87% httpd
> 56830 www 1 99 0 138M 19684K select 2 0:09 10.76% httpd
> 56887 www 1 105 0 139M 17488K select 6 0:01 10.49% httpd
[ ... ]
Your Apache processes are huge; mine typically stay under 20MB in
VSIZE even with PHP loaded (this is Apache-2.0.59 + PHP 4.4.7 or PHP
5.2.x). I suspect your PHP app(s) are leaking memory or otherwise
have some significant problems with the way they are coded.
> I had to lower MaxClients on apache substancially from 128 to 32,
> or loads
> would quickly go to 40+. (Other servers with dual cpus instead of
> quad and
> apache 1.3 on freebsd 6.0 don't have this problem)
The fact that your server starts dogging out around 40 processes is
not surprising-- 40 * ~140MB per httpd child = 5600 MB, which exceeds
the available physical memory in the system, at which point you start
swapping excessively and the performance is going to plummet.
You will have to find a way to make those httpd children smaller or
else reduce the max number you run to 30 or less.
> Now this web application isn't the best code out there, but this is
> a quad
> cpu server and it's performing a lot worse than some servers I have
> with 6.0 with apache 1.3 for over 400 days.
> Am I the only one getting terrible performance with apache2 on
> FreeBSD 6 ?
Apache-2.0 + PHP does just fine for me; I'm not sure that Apache-2.2
+ PHP5 has been as well tested or is as lightweight in resources as
the older Apache 1.3 or 2.0 flavors are. It might be worth
downgrading to an older Apache to test things out, but it really does
sound like the web app you've got is the problem more than FreeBSD 6
or the rest of your infrastructure....
More information about the freebsd-questions