Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Net::SMTP slow on linux

by shadowpuppet (Acolyte)
on Apr 22, 2002 at 14:27 UTC ( #161066=perlquestion: print w/replies, xml ) Need Help??

shadowpuppet has asked for the wisdom of the Perl Monks concerning the following question:

I'm not a spammer, but I do have code that sends alot of emails to registered users. We're migrating this code to linux, and I noticed that submission to postfix using Net::SMTP is fairly slow, about 50,000 per hour, whereas on slowlaris, we were getting about 250,000 per hour. In every other way, the linux box performs much faster. Anyone noticed Net::SMTP being slow on linux?

Replies are listed 'Best First'.
Re: Net::SMTP slow on linux
by lhoward (Vicar) on Apr 22, 2002 at 15:40 UTC
    I've done a lot of work with Net::SMTP on several platform and have found the performance to be comporable on roughly equivalent hardware regardless of OS. Perhaps if you gave us some details on your setup we could help: are you using persistant SMTP connection, how is postfix configured, is postfix running on thesame server with your perl script (i.e. was postfix also moved from Solaris to Linux), what hardware were you using for the Solaris and Linux setups, etc...
      Thanks. It's a persistant connection to localhost (actually I restart every 1000 emails). The linux server is a dual p3 1.1Ghz with 4G ram. We have two solaris, one quad 450 4G, and a dual 450 with 2G ram. The Net::SMTP performance is similar on the both. I think I may have figured out the difference in performance, the solaris server(s) are on an EMC array, while the linux is off localdisk. The performance is pretty good on linux if I send a single mail to tons of recipients, but not one mail per recipient. I need to be able to send in both ways. I guess the localdisk may explain that.
        You are correct. Postfix (and MTAs in general) are extremely disk IO intensive. If you're looking into improving performance of the system, I recomend you look into a faster disk subsystem. A lot of work can be done tweaking Postfix for optimal performance too (running a second instance for defered emails, tuning the # of processes and SMTP timeouts, moving spools onto their own disks (or at least separate partitions), if you're willing to risk loosing data in the event of a power outage you can also try using a ramdisk for spool, etc...)

        You may be able to squeeze a little more performance out of your existing system by generating (and delivery to postfix) mails in parallel. I was running on a e450 for a while with 4 CPUs and postfix and I found that my optimal generation rate was produced by having 8 simultaneoue mail generation/injection processes. Your performance may vary, but its worth looking into. If you try this, be careful not to flood postfix's mailqueues. If they grow too large performance will suffer.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://161066]
Approved by Rex(Wrecks)
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2021-09-16 16:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found