[patches] avoid unless exit()

Greg A. Woods woods-cyrus at weird.com
Thu Mar 25 10:30:42 EDT 2010

At Thu, 25 Mar 2010 21:56:26 +1100, Bron Gondwana <brong at fastmail.fm> wrote:
Subject: Re: [patches] avoid unless exit()
> On Tue, Mar 23, 2010 at 11:28:57AM +0100, Gonéri Le Bouder wrote:
> > Hi,
> > 
> > On AIX 5.3 (20CPU/96GB), the cost of process restart is very expensive. These
> > patches improve performance by avoiding unnecessary exit()
> > call.
> > 
> > avoid_shut_down_if_no_input.patch:
> >  Everytime our Alteon opens a socket for the health check, it kills a
> >  process. Just because it don't send any data. The problem can be
> >  easily reproduce with a telnet connection.
> > 
> > cyrus-imapd-2.3.16-ignore_ECONNABORTED.patch:
> >  If the connection is closed by the client, the process gets an ECONNABORTED
> >  error (Connection aborted POSIX.1). This new patch catches this error.
> I like the concept.  I'd want to review just to make sure that all
> allocated resources are being correctly released - there's a certain
> tidyness in pulling down the process completely - locks release and
> file descriptors close all by themselves!

indeed, and memory "frees" itself at exit time too, and calling free() a
whole lot of times on a sure path to exit() is a pedantic waste of time
and code (and thus maintenance).

On the other hand, avoiding process restart isn't necessarily a sane
optimization.  If fork() and exec() of a program that's already running
is expensive, then perhaps that's the path which should be optimized
first, as there's real no reason for it to be so expensive.

One culprit for slow fork() and exec() on far too many modern systems is
dynamic linking of shared libraries.  Try static-linking and see how
that affects process restart.  On my NetBSD systems static-linking makes
a _huge_ difference, even for just a very few shared libraries, and with
many shared libraries the difference is easily perceptible by human
means alone.

						Greg A. Woods

+1 416 218-0098                VE3TCP          RoboHack <woods at robohack.ca>
Planix, Inc. <woods at planix.com>      Secrets of the Weird <woods at weird.com>

More information about the Info-cyrus mailing list