I found out two things:

(1) compiling a perl script every time an e-mail message arrives is
    quite inefficient, but connecting to the database is okay
(2) I had a mail infinite loop

#1 was fixed by rewriting my .qmail-default script in C instead of perl.
It does almost exactly the same thing, except:

#2 was fixed by calling /var/qmail/bin/forward instead of
/usr/bin/sendmail to forward the message. forward adds a "Delivered-To:"
header that does mail loop checking, while sendmail doesn't.

It turns out that I had [EMAIL PROTECTED] who had set his e-mail
address forward to "baduser", so it kept looping back to himself. I did
have a check in my perl script not to forward to anything @mydomain.com,
but I didn't check for e-mail addresses that had no @ sign!

So, the perl script wasn't really responsible for jacking my system load
average up to 10; the baduser was. Upon disabling the baduser's forward,
the load average with the perl script went down to 1.5.

The load average with the C script is 0.10. Yay! ^___^

Reply via email to