Re: RFR: 8225239: Refactor NetworkInterface lookups

2019-07-05 Thread Michael McMahon

Claes,

This is great work and long overdue.
Thanks for taking care of it.

- Michael.

On 04/07/2019, 20: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


Re: RFR: 8225239: Refactor NetworkInterface lookups

2019-07-05 Thread Daniel Fuchs

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




Re: RFR: 8225239: Refactor NetworkInterface lookups

2019-07-05 Thread Claes Redestad

Thanks, Michael!

/Claes

On 2019-07-05 10:02, Michael McMahon wrote:

Claes,

This is great work and long overdue.
Thanks for taking care of it.

- Michael.

On 04/07/2019, 20: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


Re: RFR: 8225239: Refactor NetworkInterface lookups

2019-07-05 Thread Claes Redestad

Thanks, Daniel!

/Claes

On 2019-07-05 12:07, Daniel Fuchs wrote:

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