Runtime DNS resolution limits when using variables in proxy_pass
0 reputation · 02 Feb 2023, 15:13 UTC
In open-source nginx, achieving runtime DNS resolution for upstream targets typically requires using a variable within the proxy_pass directive combined with a resolver configuration. This approach prevents the server from resolving the hostname only once at startup.
However, shifting to variable-based resolution alters the core behavior of the proxy module. Specifically, this method bypasses the upstream block entirely, which removes the ability to utilize native load balancing algorithms and persistent keepalive connections to the backend servers.
When designing for high-availability environments where upstream IPs change frequently, there is a trade-off between DNS agility and connection performance.
- How does nginx handle the internal caching of these resolved addresses when the
validparameter is omitted from the resolver directive? - What are the implications for request latency when the resolver timeout is reached during a runtime lookup?