Optimizing sockets to 1000 requests/sec? (Was: Sockets and messaging services)
Gordon McMillan
gmcm at hypernet.com
Wed Nov 14 17:08:41 EST 2001
Dave wrote:
> On 14 Nov 2001, 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.
So 1000 / sec is quite possible, but you'll never get there with blocking
sockets.
- Gordon
More information about the Python-list
mailing list