Optimizing sockets to 1000 requests/sec? (Was: Sockets and messaging services)

Stephen shriek at gmx.co.uk
Thu Nov 15 02:45:34 EST 2001


> >> I've been trying to benchmark socket server and can't seem to get it
> >> past serving 200 requests per second. 
> > [snip]
> > 
> > Thread-per-request servers can't scale up too high (although it might
> > be interesting to see what stackless + microthreads would do). You'll
> > need to use the asynchronous I/O support (see the select module for
> > lower level stuff, asyncore/asynchat for slightly higher stuff). 
> 
> About 3 years ago, I wrote a Python message-slinger as a drop-in replacement 
> for my client's C code. It did around 600 msgs / sec (vs <200 / sec for the 
> client's code). That was Python 1.4 on 3 year old hardware.

Thanks for the example, Gordon. Gives me the confidence knowing that
"it is possible" ~ now I just have to work out how. It's very
reassuring, rather than having doubts and asking myself "should I 
be doing this directly in C/Java instead?" whenever I hit a problem.  

> So 1000 / sec is quite possible, but you'll never get there with blocking 
> sockets.

Even if they're threaded ?  

May I ask what you used for the 600 msgs/sec ? Select's and asyncore ?

Thanks again.

Stephen.



More information about the Python-list mailing list