On Thu, Feb 08, 2001 at 12:06:05PM -0000, Tim Goodwin wrote:
> > ok, on my Solaris, the qmail distribution is "forking" almost 10 to 20
> > processes per second.
> > 
> > This cost a lot in system ressources and system calls
> 
> Yes.  Unfortunately, Solaris isn't Unix, and qmail was designed to run
> on Unix systems.  Unix is rather good at forking, especially images as
> tiny as qmail; Solaris isn't.  As Rob Pike once said, "perhaps if
> people had understood fork() better we wouldn't have threads".
> 
> > So I'm trying to work on a threaded qmail-rspawn to avoid so many forks
> 
> Yikes.

If all he's trying to achive is reduce forking on his Solaris box, I
concur. However if we generalize the question, I don't know that I'd
draw the same conclusion.

If any area of qmail would benefit for threading, it might be the
remote delivery mechanism - currently handled by Batman and Robin, er,
sorry, qmail-rspawn and qmail-remote.

First off, there is an amount of data they can share and cache, such
as tcpok and recent DNS lookups.

Second, remote delivery can have very high latency so any footprint
saving is a big saving.

Third, the state requirements are truly tiny. A socket and an fd is
just about all that the thread needs.

Fourth, there are few security issues. Neither qmail-rspawn nor
qmail-remote need any special file system access. This is often a
nasty complication for threaded implementations. Not so here.

Fifth, the interface is simple and clean, plug in the threaded
qmail-rspawn and no one is any the wiser.

Sixth, the problem domain isn't that large:

$ wc -l qmail-rspawn.c qmail-remote.c

     103 qmail-rspawn.c
     427 qmail-remote.c
     530 total

Having said that, in the scheme of things, qmail-remote borders on
ridiculously tiny as it is. I recently wrote a queueless wrapper
program that uses qmail-remote as the smtp engine (opt-in spam I call
it). I rediscovered that a concurrency of 1,000 qmail-remotes consumes
very little system resource on FreeBSD.

> I'm going to put my manager's hat on for a moment.  How much time do
> you intend to spend on developing and debugging this?  How much does
> that time cost?  How much would it cost to buy a fast PC, run a real
> Unix (I'd suggest OpenBSD, FreeBSD, or some version of Linux) on it,
> and make that your mail server?

As a solitary exercise solely designed to speed up one system, of
course replacing the box may be a better solution.


Regards.

Reply via email to