Skip to main content

Module lb

Module lb 

Available on crate feature dns only.
Expand description

DNS-based client-side load balancer.

DnsLoadBalancer resolves a request’s target domain, caches the result, refreshes it in the background, and selects one resolved IP per request via a DnsIpPicker strategy. The selected endpoint is published on the request as a ConnectorTarget extension so a downstream connectors (tcp, pool…) connects straight to that IP, the original authority stays intact (needed for things like TLS sni).

Example use case: rotating GPRC requests between different IPs of a headless service.

Structs§

DnsLoadBalancer
Service that pins each request to an IP picked from the resolved DNS entries
DnsLoadBalancerConfig
DNS loadbalancer config used by DnsLoadBalancerLayer and DnsLoadBalancer.
DnsLoadBalancerLayer
Layer producing a DnsLoadBalancer service from a DnsLoadBalancerConfig.
HostResolution
The data a DnsIpPicker sees for a single host
RandomPicker
Random IP picker
RoundRobinPicker
Round-robin IP picker

Constants§

DEFAULT_LB_EVICT_AFTER_IDLE
DEFAULT_LB_EVICT_AFTER_STALE
DEFAULT_LB_MAX_ENTRIES
DEFAULT_LB_REFRESH_AFTER

Traits§

DnsIpPicker
Strategy that selects one IpAddr from a HostResolution.