RFR: 8225239: Refactor NetworkInterface lookups

Daniel Fuchs daniel.fuchs at oracle.com
Fri Jul 5 10:07:10 UTC 2019


Hi Claes,

That looks like a good cleanup and improvement.
Thanks for having looked into this!

best regards,

-- daniel

On 04/07/2019 21:20, Claes Redestad wrote:
> Hi,
> 
> please review this patch that refactors native java.net.NetworkInterface
> lookup logic in a few ways to address both pre-existing and recent
> regressions:
> 
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8225239
> Webrev: http://cr.openjdk.java.net/~redestad/8225239/open.01/
> 
> - adds a package-private method isBoundInetAddress that shortcuts
>    some of the paths taken by existing methods when all we want to know
>    is whether an IP address is bound to some interface on this system.
>    This allows us to iterate over only IPv4 interfaces if the sought
>    after IP address is an IPv4 address and vice versa for IPv6 addresses.
>    This means a small (1.1x) to large (5x) speedup on a variety of
>    systems, depending on how many IPv4 vs IPv6 interfaces exist on the
>    system..
> 
> - refactors how the Windows-specific GetIPAddrTable API is used: current
>    implementation looks up the global IP address table over and over,
>    once per bound address, which means time spent by operations like
>    NetworkInterface.getByInetAddress grows at least quadratically with
>    the number of interfaces on a system. Refactoring these methods so
>    that GetIPAddrTable is called once means a dramatic improvement on
>    some of the API calls, e.g getByInetAddress cost drops from ~100ms to
>    ~10ms on one of our larger test systems.
> 
> - Added some additional tests and a microbenchmark.
> 
> Testing: tier1-4 (some still ongoing, but all green so far)
> 
> Thanks!
> 
> /Claes



More information about the net-dev mailing list