First off, all the SMTP-handling code is in C. That's got to be less resource-intensive than perl.

Not when I tested it. It's hard to accurately benchmark just the SMTP-talking part of an MTA, so I'll not claim those tests were perfect, but accepting multiple emails using Net::Server::Mail did not take significantly longer nor use more memory than doing so with a regular MTA.

Second, it's already written, most bugs worked out, and someone else will fix any new bugs found.

The same is true of Net::Server::Mail.

Regarding the comparative resource-intensiveness of multiple perl processes versus a daemon, I think you're forgetting copy-on-write. You're right in that the OS will almost certainly keep modules in the disk cache if they are called multiple times by quickly-spawning processes. However, the OS still has to create a new process and address space, compile the Perl code and fill the new process memory with it. Do that several thousand times within a second and you will run out of memory even on beefy machines. With a perl daemon that forks off instances of itself, the OS uses COW for the process address space, which means that real memory consumption is far lower.

Another point not mentioned yet is resource consumption limiting. If you have qmail spawning processes you have very little control over how many processes are created simultaneously. This can be especially fatal if your database connection is slow or some other resource is blocking, your OS will simply create processes too fast for the machine to handle and crash. This can be circumvented by using ulimit or PAM, but both of these have drawbacks, are not failsafe and far more complicated than simply setting max_servers in Net::Server::PreFork.


All dogma is stupid.

In reply to Re^4: Simple (but robust) email server (receiver) by tirwhan
in thread Simple (but robust) email server (receiver) by zby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.