comparison src/stream/ngx_stream_proxy_module.c @ 6863:54cf51c4f07a

Stream: speed up TCP peer recovery. 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.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 26 Dec 2016 14:27:05 +0300
parents 906ac20234ed
children ee3645078759
comparison
equal deleted inserted replaced
6862:abb0a4189cf7 6863:54cf51c4f07a
806 } 806 }
807 } 807 }
808 808
809 u->state->connect_time = ngx_current_msec - u->state->response_time; 809 u->state->connect_time = ngx_current_msec - u->state->response_time;
810 810
811 if (u->peer.notify) {
812 u->peer.notify(&u->peer, u->peer.data,
813 NGX_STREAM_UPSTREAM_NOTIFY_CONNECT);
814 }
815
811 c->log->action = "proxying connection"; 816 c->log->action = "proxying connection";
812 817
813 if (u->upstream_buf.start == NULL) { 818 if (u->upstream_buf.start == NULL) {
814 p = ngx_pnalloc(c->pool, pscf->buffer_size); 819 p = ngx_pnalloc(c->pool, pscf->buffer_size);
815 if (p == NULL) { 820 if (p == NULL) {