From owner-freebsd-questions Fri Mar 26 8:18: 9 1999 Delivered-To: freebsd-questions@freebsd.org Received: from wolf.com (ns1.wolf.com [207.137.58.20]) by hub.freebsd.org (Postfix) with ESMTP id F269C15664; Fri, 26 Mar 1999 08:18:06 -0800 (PST) (envelope-from dan@wolf.com) Received: (from dan@localhost) by wolf.com (8.9.1/8.9.1) id IAA01215; Fri, 26 Mar 1999 08:19:27 -0800 Message-ID: <19990326081926.A1101@ns.wolf.com> Date: Fri, 26 Mar 1999 08:19:26 -0800 From: dan@wolf.com To: Steve Price , freebsd-isp@FreeBSD.ORG Cc: hamellr@dsinw.com, freebsd-questions@FreeBSD.ORG Subject: Re: Need help fine-tuning a web server (fwd) References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: ; from Steve Price on Fri, Mar 26, 1999 at 08:51:38AM -0600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I want to run a webserver that's going to probably be serving about 400 > requests simultaneously on average, but it may spike up to 900 at times. > Bandwidth-wise, it'll be moving about 600+k/sec on a PII-450 w/384 megs > RAM. There'll be a lot of CGI involved, as well as a MySQL database that's > being used for authentication as well as keeping track of a bunch of user > accounting data. I tried FreeBSD initially, but it didn't last 10 minutes > before coming down. I'll offer some advice based upon my experiences, but I've got to point out that I'm *not* veryu familiar with the kernel internals, so some of my advice might be a bit off. If so, I'm sure folks with more experience will correct my (be gentle, please!). Your config is a little light in RAM. I run a web server that averages about 250 connections, but peaks at a little over 400. I've got 256 MB RAM and have 256 MB swap configured. When I'm running 250 connections, I've usually got 20 - 50 MB of swap in use (and that's a very bad thing for a web server). To support 400 connections, I'd strongly recommend going to 512 MB RAM. And be aware that when your load hits those 900 connection peaks, you are going to be heavily into your swap space (which implies that you need to configure *plenty* of swap). > I searched on the web and checked links from the FreeBSD homepage, as well > as a couple other FreeBSD related pages that I found, but found no > information on tuning FreeBSD machines. The HOWTOs for FreeBSD are > minimal. There aren't many users out there with easily accessible > information on what they've done to make it work. > > What do I need to do to make it work? Increase the number of tasks? Can I > just use ulimit, or do I need to change stuff in the kernel? I noticed > some stuff in there limiting the per-user tasks to 64, but that didn't > look reasonable, and it looked like it got ignored anyway, so I don't know > what bearing that had on the system. How can I increase the maximum > number of file descriptors/inodes? Are there any changes I should make to > the memory management stuff, and if so where and how? What else needs to > be done to a FreeBSD machine to allow it to handle heavy load? The Apache pages at http://www.apache.org have some good useful info on tuning Apache. A search of the archives at http://www.freebsd.org will reveal a little bit of info on performance tuning, but not a lot. What I've done is compile a kernel with maxusers set to 64, and including "options CHILD_MAX=256" and "options OPEN_MAX=256" (this mihgt be somewhat misguided, but that's how I learn - by experimenting and shooting myself in the foot). I've modified /etc/login.conf to create a login class called "www". I've added "nobody" to this class. The characteristics I've defined for this class are: datasize-cur=128M stacksize-cur=64M memoryuse=128M memoryuse-cur=128M filesize=infinity maxproc=4096 maxproc-cur=2048 openfiles=4096 openfiles-cur=2048 Dan Mahoney dan@wolf.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message