windows: slow nonblocking TCP, SO_SNDBUF (from Trac) #26

Open
jakedouglas opened this Issue May 25, 2009 · 1 comment

2 participants

@jakedouglas

Moved from Trac

Reported by: spatulasnout Assigned to:

Priority: minor Milestone:

Keywords: windows slow nonblocking TCP SO_SNDBUF Cc:

Description ¶

Hi,

I ran across this article the other day, and figured I'd pass it along.

http://support.microsoft.com/kb/823764

I haven't done any benchmarks yet myself locally. But based on the article, it sounds like EventMachine may want to specify a fairly large SO_SNDBUF size on windows.

Regards,

@sodabrew

I think Workaround 2 from that KB article looks like the best approach. Excerpting here:

Method 2: Make the Socket Send Buffer Size Larger Than the Program Send Buffer Size
To modify the socket send buffer, use the Windows Sockets getsockopt function to determine the current socket send buffer size (SO_SNDBUF), and then use the setsockopt function to set the socket send buffer size. When you are finished, the SO_SNDBUF value must be at least 1 byte larger than the program send buffer size.

Modify the send call or the WSASend call to specify a buffer size at least 1 byte smaller than the SO_SNDBUF value. In the earlier example in the "Cause" section of this article, you could modify the setsockopt call to the following value,

setsockopt( sock, SOL_SOCKET, 65537, (char *) &val, sizeof( int ) );

or you could modify the send call to the following value:

send(socket, pWrBuffer, 32767, 0);

You could also use any combination of these values.

@sodabrew sodabrew added this to the v1.2.0 milestone Aug 3, 2015
@sodabrew sodabrew modified the milestone: v1.2.0, v1.2.1 Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment