Python performance

Stefan Behnel stefan_ml at behnel.de
Sat Aug 3 13:04:17 EDT 2013


Wayne Werner, 03.08.2013 15:09:
> On Fri, 2 Aug 2013, 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.
> 
> Check out Kenneth Rietz's inbox.py[1]
> 
> "It's quite quick. One instance should handle over one thousand emails per
> second."

Well, this has little to do with Kenneth Reitz. The smtpd implementation is
part of the stdlib in Python. It uses asyncore and asynchat to scale, so
you can generally expect it to be fast enough for the load in question.
Working with asyncore and asynchat isn't the most pleasant that Python can
offer, but given that it's there and has been for years, it should be
pretty ok.

Alternatively, Twisted also has a server+client implementation of SMTP:

https://twistedmatrix.com/trac/wiki/TwistedMail

Haven't used either of the two yet, though, so I can't say which is a
better start for the problem at hand.

Stefan





More information about the Python-list mailing list