UDP performance

Paul Sijben sijben at eemvalley.com
Thu Apr 20 04:41:38 EDT 2006


Serge Orlov wrote:
> Paul Sijben wrote:
>> Serge Orlov wrote:
>>> Paul Sijben wrote:
>>>> I am stumped by the following problem. I have a large multi-threaded
>>>> server accepting communications on one UDP port (chosen for its supposed
>>>> speed).
>>>>
>>>> I have been profiling the code and found that the UDP communication is
>>>> my biggest drain on performance! Communication where the client and the
>>>> server are on the same machine still takes 300ms or sometimes much more
>>>> per packet on an Athlon64 3000+ running Linux (Fedora Core 5 x64).
>>> [snip]
>>>
>>>> buf, address = socket.recvfrom(8192)
>>> I'm not an expert here, but I AFAIK UDP packet size should be kept
>>> below 512 bytes otherwise it can cause fragmentation and hence all the
>>> slow stuff like acknoledgements, timeouts, etc...
>>>
>> good point in general but in practice they are in this case. but this is
>> less of a problem on the loopback interface anyway.
> 
> Isn't it still controlled by MTU even on the loopback? What is your MTU
> on the loopback?
> 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1

eth0      Link encap:Ethernet  HWaddr 00:14:85:35:A4:5D
          inet addr:192.168.0.124  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::214:85ff:fe35:a45d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1




More information about the Python-list mailing list