RFR(s): Improving performance of Windows socket connect on the loopback adapter

Alan Bateman Alan.Bateman at oracle.com
Sat Jul 18 16:56:29 UTC 2020


On 17/07/2020 02:10, Nikola Grcevski wrote:
> Thanks for reviewing the patch Alan.
>
> I applied your suggestions in this new webrev here:
>
> http://cr.openjdk.java.net/~adityam/nikola/fast_connect_loopback_1/
>
> I renamed the macro to IN6_IS_ADDR_MAPPED_IP4_LOOPBACK, following how IN6_IS_ADDR_ANY
> is named in the same file. I hope the new name works, but if there's something more suitable I
> don't mind changing it again.
>
The standard macro is IN6_IS_ADDR_V4MAPPED so it could be more 
consistent to use that as the prefix and _LOOPBACK. It's only a minor 
point of course.

There's a small inconsistency in connect0 for the case that getsockopt 
fails. The check at L247 tests if the type is SOCK_STREAM whereas the 
check at L261 also checks if so_rv is 0. Since you initialize the type 
to 0 then both approaches are fine, just pick one. My preference is to 
drop comment lines L242-243, leave the comment that the default on 
Windows is 2s and can be shorted when it's the loopback of course.

Otherwise looks good to me although I am a bit surprised that the 
implementation of ECN would impact connections through the loopback like 
this. I assume that everything that could potentially connect through 
the loopback would want to reduce the timeout so that it can report an 
error quickly.

-Alan




More information about the net-dev mailing list