[Twisted-Python] Twisted performance?

dave at pythonapocrypha.com dave at pythonapocrypha.com
Mon Oct 7 12:08:08 EDT 2002


I'm new to the list and have started looking at Twisted as an alternative 
to our company's internal, home-grown solution. Twisted appears to have 
all the functionality I want (and more!), so the main decision point for 
me is performance. Is there a web page or document describing some 
performance characteristics of Twisted?

Requests per second is only mildly interesting to me - our application is
all about total throughput. It's essentially a custom HTTP server for
large files (few hundred megabytes), so I'm looking for total throughput
numbers for a few high-speed connections as well as for many slow (modem
or slow DSL) connections. For example, on a 800 MHz PIII with a SCSI drive
we can currently sustain around 300 Mbps total across 100 non-rate-limited
connections (pulling the data off the disk), and 300 Mbps total across
about 1000 or so 150 Kbps connections. On a faster CPU and no disk access
we occasionally hit a gigabit per second across 50 or so full-speed
connections, but my target is only about 250 Mbps per machine, assuming
the CPU is in the < 1 GHz range. One problem with our implementation is
that the performance curve drops off too quickly as number of concurrent
connections go up. I'd love to sustain 250 Mbps across 2000 or more
connections; for now we compensate by buying more CPU (which isn't too big 
of a problem).

Our current solution is a pure-Python one we built internally. Originally
we used asyncore/asynchat but it was (1) too slow and (2) too low level.
What we built fixed these problems, but the fact that we're the only users
of our library is a risk, and it's a shame to build it all ourselves if we
can get away with using like Twisted.

I'd love to hear comments and performance numbers, even if they're just
anectdotal. Additionally (or as an alternative), if anyone can point me to
some sample code I can run it against our internal performance tests - I'd
be interested in (1) an HTTP server that serves just from memory (i.e.  
returns a valid but large HTTP response of just random or junk data) and
(2) an HTTP server that just serves a file or two from disk. In both cases
the emphasis is on total throughput at varying numbers of concurrent 


P.S. Does Twisted support any sort of throughput throttling? (i.e. the 
ability to cap [average] throughput at a certain level)

More information about the Twisted-Python mailing list