Multi address tcp listeners
An ordinary tcp listener has exactly one service address associated with it. The address is defined at listener creation time and cannot be changed afterwards. The service address determines the potential target connectors for each new client connection of the tcp listener.
A multi address listener can have more than one service addresses. No address is defined at creation time. Instead, addresses can be assigned to or removed from the multi address listener dynamically during its entire lifespan. A new client connection always picks an optimal target address from the current set of addresses. There is a new listener property to define an address selection strategy. This strategy determines the criteria for selecting the optimal address for a new client connection.
Router Configuration
The router management schema is extended as follows.
- A new field called
multiAddressStrategyis added to the tcpListener configuration entity. It defines the address selection strategy. - A new configuration entity called
listenerAddressis added to the schema. This entity associates a new service address with an existing multi key listener.
Address selection strategy
The new multiAddressStrategy field in the tcpListener entity can take the following values:
none: No address selection strategy is defined for the listener. This value indicates that it is an ordinary listener which has exactly one address. The address is defined in the address field of the listener entity. This is the default value.priority: Multi address listener. This address selection strategy always picks the address with the highest priority value from the current set of reachable addresses.weighted: Multi address listener. New connections are distributed randomly among the reachable addresses according to theirweightvalues. The higher theweightof an address relative to the that of the other addresses, the higher the likelihood that it will be selected for a new connection. E.g. if each available address has the same weight value then new connections are distributed in a random uniform way among them. If, for instance, only two addresses are reachable withweightvalues 99 and 1, then the first address is selected for approximately 99% of the new connections.
New listener address entity
The new listenerAddress entity has the following fields.
address: The service address (a.k.a. routing key) value.value: An integer parameter. Thepriorityaddress selection strategy interprets this value as priority. Larger values represent higher priority. Theweightedstrategy interprets it as theweightvalue. Note that only positiveweightvalues are valid.listener: The name of the listener which this service address is to be associated with. The referred listener must already exist.
The listenerAddress entity supports create and delete operations. Service address entities can be created and deleted dynamically during the lifespan of the corresponding multi address listener.
Implementation notes
- Deletion of a service address entity does not affect already existing client connections targeting that address.
- In case of the
prioritystrategy, if multiple service addresses share the same value, those addresses will be ordered non-deterministically by the router. I.e. if there are two addresses with the same value, and that value is the highest priority, and both addresses are reachable, the router will arbitrarily choose one of those addresses to be treated as the currently highest priority address. - Each listener address holds a reference to the parent listener adaptor hence it is not allowed to delete a multi-address listener if it has any associated address.
- A vanflow record of type
VFLOW_RECORD_LISTENERis created for each individual address of a multi-address listener. The record begins and ends when the address is created and deleted, respectively. Vanflow records of the same multi-address listener have the same listener name.