Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Aug 1997 14:55:46 -0600 (MDT)
From:      Marc Slemko <marcs@znep.com>
To:        Katherine Nenno <spam_test@dittosrush.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: FreeBSD and large #s of http requests
Message-ID:  <Pine.BSF.3.95.970803144812.18576N-100000@alive.znep.com>
In-Reply-To: <3.0.2.32.19970803145947.00920210@mail.gte.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Aug 1997, Katherine Nenno wrote:

> We host a web site for a popular radio show host (#2 in the US, 1 in
> Canada).  Recently (a few months ago), we planned to have a interactive
> chat with her where people could ask her questions and she could respond.
> What we didn't count on was the number of http requests this would generate.  
> 
> The site is hosted on a Pentium Pro 200 machine with 64 meg RAM running
> Apache 1.2.0 and FreeBSD 2.1.7.  The chat script was a custom perl script
> that we contracted out to have written.  We didn't anticipate the number of
> hits that this would generate.  Within the first minute the server crashed.
> 
> Now, we have been asked if we can fix the problem and have another chat
> that will work.  Does anyone have any suggestions on the best way to do
> this?  Is it even possible without buying tons of expensive equipment?
> 

It is difficult to give specific reasons for the problem without knowing
more.  The "custom perl script" could cause a huge number of problems if
it isn't written efficiently.  

You have nowhere near enough RAM.  RAM is cheap.  128 or 256 megs would be
a start.  Be sure to increase MaxClients in your Apache setup to an
appropriate level; what is appropriate depends on the machine, the amount
of RAM, the CGI scripts running, etc.  If you go above a MaxClients of
256, you need to increase HARD_SERVER_LIMIT in httpd.h and recompile.
Increase MaxRequestsPerChild to at least a few hundred, and increase
MaxSpareServers to 40 or 50 and MinSpareServers to at least 20.

If you go above 64 meg of RAM, you need to compile your kernel with the
right MAXMEM option to tell it how much you have, eg:

	options         MAXMEM="(256*1024)"

Some of the other parameters you may want could include:

	maxusers        256
	options         "CHILD_MAX=1024"
	options         "OPEN_MAX=1024"
	options         "NMBCLUSTERS=4096"


When under heavy load, you have to look at what is happening to
see where things are slowing down.  It may be appropriate to look
into moving the CGI script into something that can be done with
mod_perl or mod_fastcgi to stop you from having to fork a new
process for each script.  Depending on how important this is to
you, you may want to hire an outside consultant with appropriate
expertise to examine what is happening on your system and adjust
things properly.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970803144812.18576N-100000>