From owner-freebsd-questions@FreeBSD.ORG Thu Jul 19 00:11:27 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1903B16A405 for ; Thu, 19 Jul 2007 00:11:27 +0000 (UTC) (envelope-from x0dapara@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.224]) by mx1.freebsd.org (Postfix) with ESMTP id BF1A413C48D for ; Thu, 19 Jul 2007 00:11:26 +0000 (UTC) (envelope-from x0dapara@gmail.com) Received: by nz-out-0506.google.com with SMTP id l8so299790nzf for ; Wed, 18 Jul 2007 17:11:26 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=QeDJ+JlB/Tt/okm6ZxESYELBIznzHvhTYhBwUdWObGR8/xht9cFB32OiEdHKkP3SWJuVsdcP3c9YTSnBdTYZVek82IoM2lyaM/NJ3nTIxswsVcRPvfTEs+KKF/Y7UD7A9hsLEG1A8Ijkd2Dsg/vLd6GVKG8rU9wMZQQK/2C/K9Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=IxIKkY4teaF/lTiU0X0DDdC18+t4otsOQ7fGsFT1GDWVnNiGBrckEfGumn3JsejchDYFFDBY0gNkPEIWfB/+dSO1g76NXGay1Pmow7KR87x4d7R8m07/m1HBBEoAt9FrhXShDCWM49z6MS2PnP/OVJIqwLawU9lWhijCTAsdZ/A= Received: by 10.142.79.15 with SMTP id c15mr166788wfb.1184803285022; Wed, 18 Jul 2007 17:01:25 -0700 (PDT) Received: by 10.143.44.2 with HTTP; Wed, 18 Jul 2007 17:01:24 -0700 (PDT) Message-ID: <2f0146460707181701t6dc06f35rebe3aef46d6b451d@mail.gmail.com> Date: Thu, 19 Jul 2007 01:01:24 +0100 From: "Michael Vaughn" To: "Chuck Swiger" In-Reply-To: <8E11EDCD-3254-4EB7-B429-960AAD435156@mac.com> MIME-Version: 1.0 References: <2f0146460707181512x3841af57l588e4d6e67bd5884@mail.gmail.com> <2f0146460707181615j46f35036pb60a4092726981d3@mail.gmail.com> <8E11EDCD-3254-4EB7-B429-960AAD435156@mac.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: FreeBSD 6.2-STABLE && apache 2.2.4 = bad performance. Help! X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2007 00:11:27 -0000 On 7/19/07, Chuck Swiger wrote: > > On Jul 18, 2007, at 4:15 PM, Michael Vaughn wrote: > >> 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 tend to see 20MB VSIZE and 15-18 MB RES; 140MB VSIZE and 20MB RES > means 120MB is either swapped out, allocated but never referenced, or > in "inactive" memory state. With apache 1.3 I see about 80K size and 35-40K RES (on a 6.2-STABLE server as of Mon Feb 26 02:46:31 UTC 2007, dual cpu i386). That memory profile of your apache is surprising and resembles only a > few cases I ran into, where people were writing huge Perl+DBD/DBI > scripts via mod_perl that inflated RAM usage significantly and caused > similar problems until some sanity checking and limiting of result > sets was implemented in their code. 60M come from pecl-APC (apc.shm_size = 60), which I've tried setting at 30, and disabling via apc.enabled=0 , both to no avail. I have, as mentioned before, disabled all the apache modules I did not need (a quick grep ^LoadModule and ^#LoadModule shows 35 enabled vs 16 disabled) . >> > 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 > > OK-- was this under your 30+ simultaneous clients load where you > start seeing problems, or was this at a point where the system was > closer to idle? CPU states: 15.6% user, 0.0% nice, 79.2% system, 0.8% interrupt, 4,4% idleSwap: 8000M Total, 8000M Free Taken right now, with a load of 10.18 and 34 apache processes. Swap was the first thing I checked, it *never* gets used at all. Compare with the other server on 6.2-STABLE/i386 apache 1.3: CPU states: 15.4% user, 0.0% nice, 21.3% system, 2.1% interrupt, 61.2% idle Huge difference, and the server that's performing well is more loaded than the one with problems, running on inferior hardware (2cpu vs 4cpu). >> > 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%. > > True enough. There's a fair difference in memory profile between the > 32-bit x86 flavor of FreeBSD and the AMD64 flavor, although I > wouldn't expect it to result in such an extreme difference. It'd be > interesting to see how the 32-bit version of 6.2 does and whether it > makes a noticable change, if you get a chance to switch out for > testing... I can't trash this server and install the i386 version on it. Tthe closer I have is the 6.2-STABLE server (exact date mentioned above) which runs on a dual xeon with 4GB ram, on i386. That one is way more loaded and the load is usually around 1-4, without noticeable slowdowns. Mark