Problem with writing fast UDP server

John Nagle nagle at animats.com
Thu Nov 20 21:48:27 EST 2008


Gabriel Genellina wrote:
> En Thu, 20 Nov 2008 14:24:20 -0200, Krzysztof Retel 
> <Krzysztof.Retel at googlemail.com> escribió:
>> On Nov 20, 4:00 pm, bieff... at gmail.com wrote:
>>> On 20 Nov, 16:03, Krzysztof Retel <Krzysztof.Re... at googlemail.com>
>>> wrote:
>>>
>>> > I am struggling writing fast UDP server. It has to handle around 10000
>>> > UDP packets per second. I started building that with non blocking
>>> > socket and threads. Unfortunately my approach does not work at all.
>>> > I wrote a simple case test: client and server. The client sends 2200
>>> > packets within 0.137447118759 secs. The tcpdump received 2189 packets,
>>> > which is not bad at all.
>>> > But the server only handles 700 -- 870 packets, when it is non-
>>> > blocking, and only 670 – 700 received with blocking sockets.
>>> > The client and the server are working within the same local network
>>> > and tcpdump shows pretty correct amount of packets received.
>>
>> I wonder if there is a kind of setting for socket to allow no delays?

    Is the program CPU-bound?  If so, CPython is too slow for what you want
to do.

					John Nagle



More information about the Python-list mailing list