upsync_lb
The `upsync_lb` directive configures load balancing behavior for upstream servers synchronizing data from backend service registries like Consul or etcd.
Description
The upsync_lb directive is used within an upstream block to specify how load balancing should be handled when synchronizing upstream server configurations from external service registries such as Consul or etcd. When enabled, it directs the NGINX server to maintain updated backend server attributes dynamically without requiring a server reload. This includes properties like server weight and maximum fail settings. It helps streamline traffic management during runtime, facilitating automatic adjustments based on real-time service availability and performance metrics.
The directive accepts a single argument, which should specify the intended load balancing strategy or mode. Its integration is crucial for maintaining optimal upstream configuration synchronization when service states change frequently. By utilizing upsync_lb, admins can ensure that from the perspective of application traffic, no abrupt performance bottleneck or downtime occurs while scaling services up or down or when server states change following health checks.
Config Example
upstream test {
upsync 127.0.0.1:8500/v1/kv/upstreams/test/ upsync_timeout=6m upsync_interval=500ms upsync_type=consul strong_dependency=off;
upsync_lb 1;
upsync_dump_path /usr/local/nginx/conf/servers/servers_test.conf;
include /usr/local/nginx/conf/servers/servers_test.conf;
}Ensure that the load balancing method is compatible with your backend service and traffic patterns.
Incorrect parameter values may lead to unintended service downtimes or performance degradation.
Not all load balancing strategies might be supported during upsync configuration. Verify against the module documentation.