From owner-freebsd-questions@FreeBSD.ORG Tue Feb 15 11:10:12 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E4DFD16A4CE for ; Tue, 15 Feb 2005 11:10:12 +0000 (GMT) Received: from male.aldigital.co.uk (male.thebunker.net [213.129.64.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4669643D48 for ; Tue, 15 Feb 2005 11:10:12 +0000 (GMT) (envelope-from matthew@thebunker.net) Received: from gravitas.thebunker.net (gateway.ash.thebunker.net [213.129.64.4]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by male.aldigital.co.uk (Postfix) with ESMTP id EDECB9761A; Tue, 15 Feb 2005 11:10:10 +0000 (GMT) Received: from gravitas.thebunker.net (localhost [127.0.0.1]) j1FBA2CW000540; Tue, 15 Feb 2005 11:10:02 GMT (envelope-from matthew@gravitas.thebunker.net) Received: (from matthew@localhost) by gravitas.thebunker.net (8.13.1/8.13.1/Submit) id j1EMiOMJ016446; Mon, 14 Feb 2005 22:44:24 GMT (envelope-from matthew) Date: Mon, 14 Feb 2005 22:43:44 +0000 From: Matthew Seaman To: Toomas Aas Message-ID: <20050214224344.GA1267@gravitas.thebunker.net> Mail-Followup-To: Matthew Seaman , Toomas Aas , questions@freebsd.org References: <420B436A.8060202@raad.tartu.ee> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <420B436A.8060202@raad.tartu.ee> User-Agent: Mutt/1.5.7i cc: questions@freebsd.org Subject: Re: Apache2 with worker MPM on 5.3 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2005 11:10:13 -0000 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 10, 2005 at 01:20:10PM +0200, Toomas Aas wrote: > We are running a fairly busy website with Apache 2.0.52. At times > a lot of httpd processes gather up and consume all the available > memory, which slows down web access. You should check and see if apache is validly spawning all those sub-processes to cope with a traffic spike, or whether there's some condition that's gumming up the works -- having a whole row of apace processes hanging because they are attempting to talk to some database that itself has gone a bit tits-up and isn't responding correctly could quite easily lead to the sort of effect you're seeing. An important tip with running Apache on high performance we sites is to limit the maximum number of clients that will be spawned at any one time so that it doesn't drive the system into swapping -- essentially decide how muchof the system RAM you can dedicate to Apache, look at the size of an individual apache process via ps(1), divide one by the other and use that as the 'MaxClients' setting in httpd.conf. Note that loading such modules as mod_perl or mod_php will increase the size of individual apace processes enormously. Don't load such modules unless you actually need them, and in some cases it may even be worth running several instances of apache, both with and without those modules, plus adroit use of proxying and mod_rewrite in order to get the best performance. Note too that Apache 1.3.x processes are generally smaller than equivalently configured Apache 2.0.x processes so may help you get the most out of your server. > Apache2 was installed from ports and defaulted to prefork MPM. I read > from the Apache performance tuning document that worker MPM may perform > better on busy websites and has smaller memory footprint. Is it safe to > run Apache2 with worker MPM on FreeBSD 5.3? There must be a reason why > prefork is the default... Prefork is the original mechanism Apache used to multiplex itself. It generally works exceedingly well on Unix systems where fork(2) is fast and efficient, which is why it is the default. Threaded MPMs may or may not be better for your particular situation, depending on: i) OS -- some have vastly better implemented threading infrastructure than others. For some, the overhead of fork()+exec() is huge, making use of threads anecessity. ii) Web application -- if you're just serving static HTML, then there's no need to use anything other than the prefork MPM. On the other hand, if you're running large, complicated web apps written in perl, PHP, Java etc. then a threaded MPM may fit better with the design of that particular application. iii) The nature of the workload -- how much data are you shifting, how much does it cost your servers to generate that data, how does demand vary with time-of-day or day-of-week. There isn't any one-size-fits-all answer. You will have to experiment with your particular set up in order to tune it for maximum performance. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 8 Dane Court Manor School Rd PGP: http://www.infracaninophile.co.uk/pgpkey Tilmanstone Tel: +44 1304 617253 Kent, CT14 0JL UK --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iQCVAwUBQhEpoJr7OpndfbmCAQJL6gP/ffMZlF9sGTlGv1ZB3ytSMH4daxz5fRML XRAw0b17Zxf+Onq3E3Hm1COh1SsHjYpLAXUENQc0T2CZJ9iNcnuW/FYa/7/oMjMC TcIyCaFdpeNv2MoBqzFCGOzWHw1aC8SYQ1I9rKr77Uq251+n12zlnpoR7aiENwQh +eNL3Tc1JGo= =gQEx -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--