Re: Squid vs Apache

From: Ricardo Galli <>
Date: Thu, 13 Mar 1997 21:49:06 +0100 (GMT+0100)

On Thu, 13 Mar 1997, Dean Gaudet wrote:

> On Wed, 12 Mar 1997, Ricardo Galli wrote:
> > Apache does a fork for every conection, apart of being slower with a high
> > load (because there is not enough time for preforking), it consumes a lot
> > of memory and CPU.
> Sorry this is entirely wrong. Apache preforks children (starting with
> the value set by StartServers). It then monitors how many children are
> busy and ensures that there are always at least MinSpareServers and at
> most MinSpareServers idle waiting for requests. Each child can handle at
> most MaxRequestsPerChild requests (or "infinite" if you set that to 0).
> So no, it definately does *not* fork for each request.

Sorry, you are wrong, doing preforking does not mean you don't do a fork
for every connection, what I meant is "every connection needs an Apache
children". Preforking is just a "trick" in order to avoid clients
waiting until the fork system call (VERY EXPENSIVE in standard UNIXes)
is finished.

> Apache is generally not as fast/efficient as a well implemented
> multithreaded server can be. But it generally is far faster than most
> people need to fill a half dozen T1s. (All depending on your
> hardware of course.)

NOTE: Squid IS NOT multithreaded, but event driven (the infamous

Apart of being fork the most expensive system call (or perhaps exec is
the first and fork the second) in UNIX (the kernel has to create and
fullfill the new PCBs and make a copy the whole process memory pages**),
every child consumes exactly the same memory as its parent does (of
course, shared libraries don't count), and therefore the amount of memory
that Apache consumes (about 936 KB each children in my WWWW server) is
directly proportional to the amount of open connections (100 simultaneous
sessions is normal for 30-40 LAN users).

Do not forget another thing, the scheduler has to do a context switching
(many clock ticks) for every children.

> But yes, as a pure proxy cache Apache is nowhere near the performance of
> squid. But if you want to run a hybrid proxy/server it's very versatile.

Do not forget to kill zombies processes and restart the parent...

I like very much Apache as a WWW server, but I hate it for cache/proxy. I
was using it for a couple on months for a maximun of 16 users, I've got
hundred of zombies (defuncts processes) in that period ;-)


** I know most unixes implement for with a copy-on-write policy, but you
can be almost sure that MANY pages need to be copied in our case, because
each apache children does a lot of work and therefore accessing to many
different pages.
Received on Thu Mar 13 1997 - 13:03:53 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:41 MST