Skip to content
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

Round-robin DNS resolution #594

Merged
merged 1 commit into from
Apr 8, 2018
Merged

Round-robin DNS resolution #594

merged 1 commit into from
Apr 8, 2018

Conversation

jchambers
Copy link
Owner

This change introduces a round-robin DNS resolver. This will allow clients to spread their concurrent connections across a range of APNs and should, as a side effect of using Netty's DNS resolver, notice changes in the server list more quickly.

It has no effect if the client is using a proxy.

@@ -84,7 +85,8 @@
this.bootstrapTemplate.option(ChannelOption.TCP_NODELAY, true);
this.bootstrapTemplate.remoteAddress(apnsServerAddress);
this.bootstrapTemplate.resolver(proxyHandlerFactory == null ?
DefaultAddressResolverGroup.INSTANCE : NoopAddressResolverGroup.INSTANCE);
new RoundRobinDnsAddressResolverGroup(ClientChannelClassUtil.getDatagramChannelClass(eventLoopGroup),
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readers/reviewers, this is the key change. Pretty much everything else is just adding dependencies on Netty's DNS resolver module or expanding ClientChannelClassUtil to cover datagram sockets, too.

@jchambers jchambers force-pushed the round_robin_resolver_group branch 2 times, most recently from 85dc568 to 9db228f Compare April 8, 2018 18:23
@jchambers jchambers force-pushed the round_robin_resolver_group branch from 9db228f to cb3d741 Compare April 8, 2018 18:28
@jchambers jchambers merged commit 4ea1831 into master Apr 8, 2018
@jchambers jchambers deleted the round_robin_resolver_group branch April 8, 2018 18:33
@palex-fpt
Copy link

This change leads to UDP socket leaks. Every instance of AddressResolverGroup subscribes to EventLoopGroup#terminationFuture. When EventLoopGroup is shared between several ApnsClient instances there is no way correctly terminate that resolvers as ApnsClient#close does not remove instance of resolver.

@jchambers
Copy link
Owner Author

@palex-fpt Good catch. Could you please file a separate issue for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants