Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Speed issue sending UDP data on XP SP2 vs XP SP3

Status
Not open for further replies.

Clairvoyant1332

Programmer
May 21, 2003
147
US
I have a multicast file transfer program which seems to be having some issues with speed on particular versions of Windows.

I had a user of the software email me saying he was unable to get efficient file transfer speeds when running the sender under Vista SP2 or XP SP3, but good speeds on XP SP1 as well as Linux. I ran a test on my end between two boxes, one running XP SP2 and the other running XP SP3, connected via 100Mbps Ethernet. With the SP2 box as the sender, configured with no delay between sends, I'm able to run at about 90% line speed. The average time between sends is about .120 ms (optimal being .111 ms), and a Wireshark trace indicates this to be pretty consistent. When I switch it around so the SP3 box is the sender, again with no delay between packets, it only runs at about 53% line speed. In this case we're looking at around .210 ms between sends, again with Wireshark showing it to be consistent.

I also whipped up a simple UDP sender and saw the same behavior. On the SP2 box, network utilization while sending never went above 60%, while receiving it was over 95%.

So the question here is what in SP3 could be causing this slowdown? I took a peek at the SP3 Overview documents and nothing's jumping out at me. All the network code is Berkley sockets, as it need to compile on multiple OS's.

The source for the test sender can be found at It takes two parameters, the destination IP and port.

The source and Windows EXEs for the full application, UFTP, can be found at
Thanks,
Dennis
 
I've found solution to this issue.

Apparently XP SP3 and later throttle back transmission of UDP datagrams that are larger than 1024 bytes (by default). This can be changed by setting the following DWORD registry variable:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters\FastSendDatagramThreshold

I set this to 1500 (the maximum size of a regular ethernet frame) and rebooted, and it took care of my speed issues.
 
Just wondering whether the following will work on all machines. Then you won't need to modify the registry on specific ones.
Code:
setsockopt(m_SocketTx, SOL_SOCKET, SO_SNDBUF, (char *)&bufferSize, sizeof(bufferSize));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top