Score:-2

localhost loopback tcp connection in Windows: increase the bottleneck of 65535 bytes per segment

us flag

The scenario that I have is as such: I have a loopback TCP session and I want to improve its performance. I have my socket-like objects (System.Net.Sockets in .NET Framework, to be specific) sending messages of up to about 9MB each flowing in both directions of the TCP connection. I have observed typical delays of about 20ms for such a big message to get to the other side.

With WireShark, I found that the TCP flow is limited by 65535 bytes per segment. I'm suspecting this is the bottleneck of the speed performance. In the TCP headers, the window scaling option is enabled, and the calculated window size is sufficiently huge. I'm suspecting that the "TCP Option - Maximum segment size" (MSS) in the SYN packet is what limits the size of each TCP segment. Please see the WireShark images, and point out if I'm wrong.

the size-limited TCP segments, and the window scaling options The SYN packet and the MSS

Now comes back to the question in the title. In Windows 7/8/10/11, is there any way to upraise this TCP segment size limit? I'm hoping to find a method that increases the MSS only for loopback connections or only for certain ports or something.

Score:1
ru flag

A TCP segment is encapsulated by an IP packet which is generally limited to 65,535 bytes (2^16-1) since the Total Length field is 16 bit. That's the end of the ladder for both TCP and IP.

If you can't achieve the bandwidth you require you need either faster hardware or faster software. By default, my desktop box runs ~35 Gbit/s single-threaded. You might want to ask over at Stack Overflow for optimizing your code.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.