Skip to content

Improve service URL DNS resolution #929

Closed
@merlimat

Description

Expected behavior

When doing lookups, we are connecting to the endpoint represented by its serviceUrl. When using native Pulsar protocol, we should resolve the DNS at each attempt, in order to adapt when the DNS config changes.

Additionally, at each attempt, we need to try all the IP addresses returned by DNS, since in same cases DNS is used as a service discovery mechanism.

This is already working correctly on HTTP based lookup where the serviceUrl is passed to asyncHttpClient library.

Actual behavior

Currently, the client impl is resolving the serviceUrl name at startup at it is caching the 1st IP address:

https://github.com/apache/incubator-pulsar/blob/4288839fb82f2c64549fc8c6fb4f70db2b72b961/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java#L52

  • We should defer resolving until we are actually connecting, so that new attempts might be leading to a different IP returned by DNS server.
  • We should try all the returned IP addresses until a successful connection can be established
  • Additionally, we should use Netty async DnsResolver class to do it asynchronously.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

type/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions