summaryrefslogtreecommitdiffhomepage
path: root/src/stream/ngx_stream_upstream_round_robin.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-11-07Upstream: per-upstream resolver.Vladimir Homutov1-6/+6
The "resolver" and "resolver_timeout" directives can now be specified directly in the "upstream" block.
2024-11-07Upstream: construct upstream peers from DNS SRV records.Dmitry Volyntsev1-1/+11
2024-11-07Upstream: re-resolvable servers.Ruslan Ermilov1-10/+194
Specifying the upstream server by a hostname together with the "resolve" parameter will make the hostname to be periodically resolved, and upstream servers added/removed as necessary. This requires a "resolver" at the "http" configuration block. The "resolver_timeout" parameter also affects when the failed DNS requests will be attempted again. Responses with NXDOMAIN will be attempted again in 10 seconds. Upstream has a configuration generation number that is incremented each time servers are added/removed to the primary/backup list. This number is remembered by the peer.init method, and if peer.get detects a change in configuration, it returns NGX_BUSY. Each server has a reference counter. It is incremented by peer.get and decremented by peer.free. When a server is removed, it is removed from the list of servers and is marked as "zombie". The memory allocated by a zombie peer is freed only when its reference count becomes zero. Co-authored-by: Roman Arutyunyan <arut@nginx.com> Co-authored-by: Sergey Kandaurov <pluknet@nginx.com> Co-authored-by: Vladimir Homutov <vl@nginx.com>
2020-11-27Upstream: excluded down servers from the next_upstream tries.Ruslan Ermilov1-3/+17
Previously, the number of next_upstream tries included servers marked as "down", resulting in "no live upstreams" with the code 502 instead of the code derived from an attempt to connect to the last tried "up" server (ticket #2096).
2016-04-11SSL: removed OpenSSL 0.9.7 compatibility.Sergey Kandaurov1-4/+1
2018-07-17SSL: save sessions for upstream peers using a callback function.Sergey Kandaurov1-1/+1
In TLSv1.3, NewSessionTicket messages arrive after the handshake and can come at any time. Therefore we use a callback to save the session when we know about it. This approach works for < TLSv1.3 as well. The callback function is set once per location on merge phase. Since SSL_get_session() in BoringSSL returns an unresumable session for TLSv1.3, peer save_session() methods have been updated as well to use a session supplied within the callback. To preserve API, the session is cached in c->ssl->session. It is preferably accessed in save_session() methods by ngx_ssl_get_session() and ngx_ssl_get0_session() wrappers.
2016-12-26Stream: speed up TCP peer recovery.Roman Arutyunyan1-0/+29
Previously, an unavailable peer was considered recovered after a successful proxy session to this peer. Until then, only a single client connection per fail_timeout was allowed to be proxied to the peer. Since stream sessions can be long, it may take indefinite time for a peer to recover, limiting the ability of the peer to receive new connections. Now, a peer is considered recovered after a successful TCP connection is established to it. Balancers are notified of this event via the notify() callback.
2016-10-31Upstream: added the ngx_http_upstream_resolved_t.name field.Ruslan Ermilov1-1/+1
This fixes inconsistency in what is stored in the "host" field. Normally it would contain the "host" part of the parsed URL (e.g., proxy_pass with variables), but for the case of an implicit upstream specified with literal address it contained the text representation of the socket address (that is, host including port for IP). Now the "host" field always contains the "host" part of the URL, while the text representation of the socket address is stored in the newly added "name" field. The ngx_http_upstream_create_round_robin_peer() function was modified accordingly in a way to be compatible with the code that does not know about the new "name" field. The "stream" code was similarly modified except for not adding compatibility in ngx_stream_upstream_create_round_robin_peer(). This change is also a prerequisite for the next change.
2016-09-29Modules compatibility: upstream config field.Maxim Dounin1-0/+2
It is to be used to track version of an upstream configuration used for request processing.
2016-09-29Stream: style.Ruslan Ermilov1-0/+2
Explicitly initialized peer's max_conns for upstreams created with variables similar to how it's done in http.
2016-09-22Upstream: max_conns.Ruslan Ermilov1-0/+11
2016-09-22Upstream: removed the quick recovery mechanism.Ruslan Ermilov1-6/+0
Its usefulness it questionable, and it interacts badly with max_conns.
2016-09-22Upstream: style.Maxim Dounin1-1/+0
2016-06-14Stream: variables in proxy_pass and proxy_ssl_name.Vladimir Homutov1-0/+135
2016-03-30Style.Ruslan Ermilov1-1/+1
2015-05-20Upstream: report to error_log when max_fails is reached.Ruslan Ermilov1-0/+5
This can be useful to understand why "no live upstreams" happens, in particular.
2015-04-20Stream: port from NGINX+.Ruslan Ermilov1-0/+697