Skip to content

FileBasedDiscovery causes connections on every ping round #21739

@bleskes

Description

@bleskes

Currently UnicastHostsProvider#buildDynamicNodes is called multiple times during the pinging rounds. Once on start, one more after 1.5 seconds (by default) and last time at the end (3s by default). My guess is that this done in an attempt to get the latest information possible when connect to EC2 / GCE/ Azure's API. This does have a nasty side effect on the FileBasedUnicastHostsProvider, which currently reads it's file on ever call. The file reading is not a problem on it's own as it is just as fast as an EC2 call. The problem part is that each read generates nodes with new node ids, meaning that UnicastZenPing will setup new connections with each of these rounds.

I see two relatively easy ways of solving it:

  1. Call buildDynamicNodes once at the beginning of each round (might be the simplest).
  2. Add an "onStartPing" method to UnicastHostsProvider which is guaranteed to be called at the beginning of each pinging round. FileBasedDiscovery can read the file contents in that method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions