Re: Apache2 with worker MPM on 5.3

2005-02-15 Thread Toomas Aas
Matthew Seaman wrote:
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:
Thanks a lot for the insight, Matthew. on Sunday I tried installing 
Apache2 with worker MPM and found out that I also had to rebuild PHP to 
make libphp4.so support threading. And then I found out that several PHP 
extensions that we need (such as php4-mysql) do not want to work with 
threading enabled. I didn't spend too much time investigating because I 
wanted to get the web server back up within reasonable time, but it 
seems that some PHP extensions just aren't considered thread safe and 
refuse to load when threaded version of PHP is in use.

So I had to put back Apache2 with prefork MPM. On the positive note, it 
has been performing better than before. Upgrading the Apache and PHP 
ports to latest may have something to do with it, as well as me finding 
and fixing a procedure which occasionally pulled /var/tmp full from 
remote server via http (aargh).
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Apache2 with worker MPM on 5.3

2005-02-15 Thread Matthew Seaman
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

-- 
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


pgpVKqhz2qwuJ.pgp
Description: PGP signature


Apache2 with worker MPM on 5.3

2005-02-10 Thread Toomas Aas
Hello!
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.
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...
--
Toomas Aas 
|arvutivõrgu peaspetsialist | head specialist on computer networks|
|Tartu Linnakantselei   | Tartu City Office   |
- +372 736 1274
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"