Re: squid rewrite

From: Dean Gaudet <dgaudet-list-squid-dev@dont-contact.us>
Date: Fri, 6 Jun 1997 10:19:48 -0700 (PDT)

On Fri, 6 Jun 1997, Andres Kroonmaa wrote:
> > Shared memory and semaphores are best let alone if we are thinking of
> > being portable... and if using a central manager then it can be avoided
> > without to much performance degration.
>
> Semaphores can be implemented in software in worst case, but is shared
> memory really a porting problem?

We use shmget() or mmap() to get shared memory in Apache... and almost
every architecture has one or the other in a useable form. See the
src/conf.h file and look for "HAVE_SHMGET" or "HAVE_MMAP" under each arch
to see how far its spread. Note that when that code was put in it was up
to individuals using each arch to submit a patch to enable one or the
other, so we may have missed some. (Like linux should have had
HAVE_SHMGET ages ago.)

The alternative if neither is present is to use an on-disk file (unlinked
after creation) which requires read()s and lseek/write to synchronize. But
there are unavoidable race conditions on these architectures...

However we use it mostly for statistical information. In fact as of a
patch I wrote for post-1.2, the children never read the memory, except to
do number_of_reqs_served++ operations (each child has its own counter, no
synchronization problems), and when serving the /server-status page. So
we probably could also get away with using pipe()s or socketpair()s to
communicate with the parent.

Dean

P.S. I hope nobody is bothered by me using Apache as an example... I know
there's some animosity towards it here, but I'm assuming that's mostly
towards its proxy part, which is not nearly as robust as Squid.
Received on Tue Jul 29 2003 - 13:15:41 MDT

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