-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance usage of FQDN
in PoolKey
#2733
Conversation
@yuzawa-san Can you please elaborate more on how we will handle different subdomains? |
@violetagg I set a breakpoint in the existing code when my client hits System.out.println(AddressUtils.createUnresolved("wikipedia.org", 443).equals(AddressUtils.createUnresolved("en.wikipedia.org", 443))); prints is the concern that some resolved InetSocketAddresses could be bucketed in the pool together? like weird mixtures of resolved and unresolved InetSocketAddresses or ip-address only vs hostname only InetSocketAddresses? or would it be inconsistent across different java versions? looks like it would work: https://github.com/openjdk/jdk/blob/jdk-11%2B0/src/java.base/share/classes/java/net/InetSocketAddress.java#L112 I can post some more mixtures shortly if you need more concrete examples |
Can you try this?
|
Replace SocketAddress.toString()
@violetagg my original traces all involved unresolved InetSocketAddresses, but the wikipedia examples are a prime example of where the resolved addresses are the same and thus equals and hashcode bucket them into the same pool key. i found a solution which only uses FQDN for tiebreaking when the InetSocketAddress has a resolved address. this has a fast path still for the unresolved addresses coming out of the UriEndpointFactory. since those are unresolved, we can skip the fqdn and lean directly on the equals and hashcode of InetSocketAddress. i also added a test case. i found that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuzawa-san Thanks
only two small comments
reactor-netty-core/src/main/java/reactor/netty/resources/PooledConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/test/java/reactor/netty/resources/PoolKeyTest.java
Outdated
Show resolved
Hide resolved
@reactor/netty-team PTAL |
FQDN
in PoolKey
Co-authored-by: Violeta Georgieva <milesg78@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuzawa-san , thanks for the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
FQDN
in PoolKey
FQDN
in PoolKey
Replace SocketAddress.toString() Co-authored-by: Violeta Georgieva <violetag@vmware.com>
The SocketAddres.toString method to generate the FQDN is relatively heavy and it appears to be unnecessary given the socket address is being hashed and equaled already. This should work for unix domain sockets as well.
This code:
prints out:
before:
and after this is basically gone
I also fixed up the hashCode like I did in #2732