[Esd-l] Making procmail play "nice"

Kenneth Porter shiva at sewingwitch.com
Sat Sep 27 12:03:51 PDT 2003


--On Saturday, September 27, 2003 12:26 AM -0600 Brett Glass 
<brett at lariat.org> wrote:

> Oops! Stop right there. This means lots of overhead. I'd want to avoid
> invoking an instance of Perl, since this involves several megabytes of
> working set and compilation of a script.

Do you use SpamAssassin, with spamc/spamd client/server mechanism? MD works 
much the same way.

The child processes hold a copy of Perl, but they operate as a pool and 
(like any group of processes running from the same binary) share the same 
code memory. That means the Perl start-up cost (including script 
compilation) only applies when the system is started, and the working set 
cost is really just each process' data memory. The code is shared.

As mail comes in, it gets dispatched by the multiplexor to one of the free 
processes in the pool, and that process performs the filtering using 
compiled Perl.

This inspires me to suggest an improvement to the Sanitizer: Take the Perl 
out and run it in a daemon process, answering to a Unix domain socket. A 
small client can be invoked from procmail to send the message to be scanned 
to the daemon. The daemon should run in a non-root sandbox as it's not 
doing anything that requires privileges. This would eliminate the Perl 
start-up cost per-message, and eliminate the line-length issues in the 
current Sanitizer. It does make the setup messier as each OS has different 
ways to run a daemon.


More information about the esd-l mailing list