[Mimedefang] General Libmilter Question
David F. Skoll
dfs at roaringpenguin.com
Wed Jul 24 08:28:09 EDT 2013
On Wed, 24 Jul 2013 19:11:17 +0900
Nate Findley <nathan at zenlok.com> wrote:
> Is this why mimedefang has the multiplexor in the first place? Does
> it make managing slaves and global data easier somehow than simply
> having the mimedefang.c code do this? Or is the multiplexor
> architectural decision coming from a completely different angle?
Don't forget, the main part of MIMEDefang is written in Perl, not C.
So there are two very good reasons for using the multiplexor:
1) You can't be sure some random Perl module from CPAN will be thread-safe.
So if you want MIMEDefang to be thread-safe, you'll need to serialize all
milter callbacks which will have absolutely horrible performance, or do the
serialization in your Perl filter which is a pain in the neck.
2) Many Perl modules leak memory like a dribbling infant leaks saliva,
so isolating them into their own processes and periodically
killing/restarting them as in Apache's preforked multiprocessing
module helps keep the system robust.
If you're going to write your milter in C, then the multiplexor makes no
sense because you should be able to write thread-safe code quite easily.
More information about the MIMEDefang