Taking advantage of TCP Loopback fast path in Windows

Kirk Shoop (MS OPEN TECH) Kirk.Shoop at microsoft.com
Wed Sep 24 02:20:52 UTC 2014


Thanks for taking a look!

The IOCTL only affects the selection of a shorter code path when the socket is connected and only if both end-points are on the same machine and both end-points have set the IOCTL. so setting it only on one side or on another machine has no affect.

"Applying SIO_LOOPBACK_FAST_PATH to a socket which will be connected to a non-loopback path will have no effect."
http://msdn.microsoft.com/en-us/library/windows/hardware/jj841212(v=vs.85).aspx

This article has more to say about what the IOCTL does.
http://blogs.technet.com/b/wincat/archive/2012/12/05/fast-tcp-loopback-performance-and-low-latency-with-windows-server-2012-tcp-loopback-fast-path.aspx

In an abundance of caution, this change only sets this IOCTL when a newly defined setting is set to true. By default the setting does not exist and the result is that this IOCTL is not set by default.

Our testing has included test apps using netty and direct calls and a real service (in test).
We have tested the combinations of IOCTL/No-IOCTL on the client and server side.

I think that removing the call to GetVersionEx is possible. If you like, we can try the change that way and send it back.

Kirk

Software Design Engineer
Microsoft Open Technologies, Inc.

MS Open Tech is hiring (http://aka.ms/msopentechjobs)!
Ask me for details if anyone you know is interested.

________________________________________
From: net-dev <net-dev-bounces at openjdk.java.net> on behalf of Bernd Eckenfels <bernd-2014 at eckenfels.net>
Sent: Tuesday, September 23, 2014 6:44 PM
To: net-dev at openjdk.java.net
Subject: Re: Taking advantage of TCP Loopback fast path in Windows

Hello,

Is the GetVersionEx the recommended way to check for this feature? (we
had some trouble with manifests in the past and I think there is a new
version helper api to query for minimum levels?)  Or would it easier to
just try it and remeber the WSAEOPNOTSUPP?

I see on MSDN the only reason why you would not want to enable it is
the limited set of socket options. But if those (and it looks
like) cover all the JDK use there is no harm in turning it on,
right?

If I understand it right you always set the flag, especially also on
wildcard binds so that the listen socket is set up correctly in case it
is a connection from localhost, right? Does this safely handle
connects from other clients who do not set the flag?

Gruss
Bernd


 Am Wed, 24 Sep 2014 01:19:24 +0000
schrieb "Martin Sawicki (MS OPEN TECH)" <marcins at microsoft.com>:

> Hello
> We're proposing an improvement to the OpenJDK which enables users to
> take advantage of the TCP loopback fast path mechanism in Windows for
> significantly higher performance of sockets whose both end points are
> on the same machine.  This is especially relevant in distributed
> server-side/cloud scenarios, such as Hadoop.
>
> We have the code figured out and tested internally. I've uploaded our
> webrev package here (too big to send as an attachment):
>
> https://openjdkcontrib.blob.core.windows.net/tcploopback/webrev-20140918.zip
>
> The crux of the change lies in enabling the SIO_LOOPBACK_FAST_PATH
> IOCTL flag on each socket creation call in Windows.
>
> As for activating this optimization, we're proposing the conservative
> approach of keeping it off by default and adding a command line
> argument to activate it: -Dwindows.enableFastLocalTcpLoopback=true |
> false
>
> (IMHO though, it'd be great to eventually just have it on by default).
>
> We'd appreciate a review and acceptance of this improvement.
>
> And, as we are new in the OpenJDK community and this may as well be
> our first contribution to Java, I apologize for any steps in the
> submission process that I may have missed here and would appreciate
> guidance as needed.
>
> Best regards
>
> Martin Sawicki (and Kirk Shoop, and Valeriy Kopylov)
> Microsoft Open Technologies, Inc.
> A subsidiary of Microsoft Corp.
>
>



More information about the net-dev mailing list