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

Benjamin Schollnick junkster at rochester.rr.com
Thu Nov 15 06:09:51 EST 2001


In article <97ae44ee.0111142345.5679aca4 at posting.google.com>,
 shriek at gmx.co.uk (Stephen) wrote:

> > >> 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 ?  

Please keep in mind this might be a OS issue.

For example, if your using Windows NT _Client_ (maybe Win 2000 & Win XP 
as well), that you are limited to 10 concurrent connections at anyone 
time.

I didn't see anywhere where you discussed your setup, so if your threads 
are taking any significant time, or if you are not closing your threads 
fast enough, you maybe running into a OS imposed limitation.

         - Benjamin



More information about the Python-list mailing list