Date: Thu, 19 Jul 2007 00:17:42 +0100 From: "Michael Vaughn" <x0dapara@gmail.com> To: freebsd-questions@freebsd.org Subject: Fwd: FreeBSD 6.2-STABLE && apache 2.2.4 = bad performance. Help! Message-ID: <2f0146460707181617v7c536b43i7f411b70661fabe@mail.gmail.com> In-Reply-To: <2f0146460707181615j46f35036pb60a4092726981d3@mail.gmail.com> References: <2f0146460707181512x3841af57l588e4d6e67bd5884@mail.gmail.com> <AC4A3AA7-63A7-460F-891B-1BF8F9068F41@mac.com> <2f0146460707181615j46f35036pb60a4092726981d3@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/19/07, Chuck Swiger <cswiger@mac.com> wrote: > On Jul 18, 2007, at 3:12 PM, Michael Vaughn wrote: > > Hello everyone, > > Hi-- > > > I am contacting -performance, -questions, and -hackers in the hope > > someone > > 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 > appropriate one. > > [ ... ] > > Right after starting apache, the loads on the server will climb to > > 10-40's > > and the application will become unacceptably slow. This will go on > > until few > > users are using the said application. (note: other servers running > > older > > 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. > The SIZE is huge; What they really use is about 20-30Mb as would be > expected. > 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. Swap: 8000M Total, 8000M Free 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. I have tried disabling pecl-APC and I already have most of the modules commented out on httpd.conf. Nothing special running, other than php & extensions, and mod_security2. The least I got was 70Mb per child. > 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 > > running > > 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.... > > I might give 2.0 a go; I felt this was worth mentioning because most of > the cpu time is spent on system, even with just 32 MaxClients. Do note I mentioned the same app runs on inferior, with loads of 0-4 (not optimal, but there is no noticeable slowdown there) on FreeBSD 6.0/i386 apache 1.3 (this is 6.2-STABLE/amd64 apache 2.2.4), and that is also part of the reason I went ahead and mailed the list. It doesn't make sense that a server with twice the ram, twice the processors and a recent OS version is spending 70% of the time in system% whereas the old servers running for 400+ days spend about 25% in system%. Thanks for your reply. Also -- > -Chuck > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2f0146460707181617v7c536b43i7f411b70661fabe>