Python performance

Tim Chase python.list at tim.thechases.com
Fri Aug 2 08:59:26 EDT 2013


On 2013-08-02 14:00, Schneider wrote:
> I have to write a small SMTP-Relay script (+ some statistic infos)
> and I'm wondering, if this
> can be done in python (in terms of performance, of course not in
> terms of possibility ;) ).
> 
> It has to handle around 2000 mails per hour for at least 8hours a
> day (which does not mean, that it is allowed not to respond the
> rest of the day.
> 
> Can this be done? or should I better use some other programming
> language? My second choice would be erlang.

I suspect it depends on a lot of factors:

- will your network connection support that much traffic?  (And an
  ISP that will grant you permission to spew that volume of email?)

- are these simple text emails, or are they large with lots of
  attachments, inline images, PDFs, or whatever?

- are the statistics that you're gathering simple, or do they require
  complex analysis of the documents passing through?

- is the load 8hr straight of spewing email, or is it bursty?  If
  it's bursty, you can internally queue them up when load gets high,
  delivering them from that queue when load diminishes.  Given the
  store-and-forward nature of email, there's no guarantee that if
  you spewed them at ~33/minute (that/s a little faster than one
  every two seconds), they'd arrive at their destination any faster
  than if you'd queued them up and sent them at a more steady rate.

That said, sending ~33 text emails per minute doesn't seem impossible,
it just depends on your configuration (network, DNS, and receiving
SMTP server(s) throttling/setup)

-tkc










More information about the Python-list mailing list