[njs] Version 0.1.7.

2016-12-26 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/15dc54100400
branches:  
changeset: 290:15dc54100400
user:  Igor Sysoev 
date:  Tue Dec 27 10:39:53 2016 +0300
description:
Version 0.1.7.

diffstat:

 Makefile |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (10 lines):

diff -r 58342f302de3 -r 15dc54100400 Makefile
--- a/Makefile  Fri Dec 23 19:42:15 2016 +0300
+++ b/Makefile  Tue Dec 27 10:39:53 2016 +0300
@@ -1,5 +1,5 @@
 
-NJS_VER =  0.1.6
+NJS_VER =  0.1.7
 
 NXT_LIB =  nxt
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Added tag 0.1.7 for changeset 15dc54100400

2016-12-26 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/1944eaa4b2cf
branches:  
changeset: 291:1944eaa4b2cf
user:  Igor Sysoev 
date:  Tue Dec 27 10:40:08 2016 +0300
description:
Added tag 0.1.7 for changeset 15dc54100400

diffstat:

 .hgtags |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (8 lines):

diff -r 15dc54100400 -r 1944eaa4b2cf .hgtags
--- a/.hgtags   Tue Dec 27 10:39:53 2016 +0300
+++ b/.hgtags   Tue Dec 27 10:40:08 2016 +0300
@@ -5,3 +5,4 @@ 360449773d51e7f451e5396e27021badc6b86085
 508689c1fb94c23f6b24be087c1dc63b2f9e6654 0.1.4
 9c813c2bb2acfd5b6e9d1e9b6699af928baea15a 0.1.5
 44b524f7e313369cd062a387511ea6fdc427875f 0.1.6
+15dc54100400f99c3ec044d8fb0175dd3d69adcb 0.1.7
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Stream: speed up TCP peer recovery.

2016-12-26 Thread Roman Arutyunyan
details:   http://hg.nginx.org/nginx/rev/54cf51c4f07a
branches:  
changeset: 6863:54cf51c4f07a
user:  Roman Arutyunyan 
date:  Mon Dec 26 14:27:05 2016 +0300
description:
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.

diffstat:

 src/stream/ngx_stream_proxy_module.c |   5 
 src/stream/ngx_stream_upstream.h |   3 ++
 src/stream/ngx_stream_upstream_round_robin.c |  29 
 3 files changed, 37 insertions(+), 0 deletions(-)

diffs (81 lines):

diff -r abb0a4189cf7 -r 54cf51c4f07a src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c  Sat Dec 24 18:01:14 2016 +0300
+++ b/src/stream/ngx_stream_proxy_module.c  Mon Dec 26 14:27:05 2016 +0300
@@ -808,6 +808,11 @@ ngx_stream_proxy_init_upstream(ngx_strea
 
 u->state->connect_time = ngx_current_msec - u->state->response_time;
 
+if (u->peer.notify) {
+u->peer.notify(>peer, u->peer.data,
+   NGX_STREAM_UPSTREAM_NOTIFY_CONNECT);
+}
+
 c->log->action = "proxying connection";
 
 if (u->upstream_buf.start == NULL) {
diff -r abb0a4189cf7 -r 54cf51c4f07a src/stream/ngx_stream_upstream.h
--- a/src/stream/ngx_stream_upstream.h  Sat Dec 24 18:01:14 2016 +0300
+++ b/src/stream/ngx_stream_upstream.h  Mon Dec 26 14:27:05 2016 +0300
@@ -24,6 +24,9 @@
 #define NGX_STREAM_UPSTREAM_MAX_CONNS 0x0100
 
 
+#define NGX_STREAM_UPSTREAM_NOTIFY_CONNECT 0x1
+
+
 typedef struct {
 ngx_array_tupstreams;
/* ngx_stream_upstream_srv_conf_t */
diff -r abb0a4189cf7 -r 54cf51c4f07a 
src/stream/ngx_stream_upstream_round_robin.c
--- a/src/stream/ngx_stream_upstream_round_robin.c  Sat Dec 24 18:01:14 
2016 +0300
+++ b/src/stream/ngx_stream_upstream_round_robin.c  Mon Dec 26 14:27:05 
2016 +0300
@@ -16,6 +16,8 @@
 
 static ngx_stream_upstream_rr_peer_t *ngx_stream_upstream_get_peer(
 ngx_stream_upstream_rr_peer_data_t *rrp);
+static void ngx_stream_upstream_notify_round_robin_peer(
+ngx_peer_connection_t *pc, void *data, ngx_uint_t state);
 
 #if (NGX_STREAM_SSL)
 
@@ -288,6 +290,7 @@ ngx_stream_upstream_init_round_robin_pee
 
 s->upstream->peer.get = ngx_stream_upstream_get_round_robin_peer;
 s->upstream->peer.free = ngx_stream_upstream_free_round_robin_peer;
+s->upstream->peer.notify = ngx_stream_upstream_notify_round_robin_peer;
 s->upstream->peer.tries = ngx_stream_upstream_tries(rrp->peers);
 #if (NGX_STREAM_SSL)
 s->upstream->peer.set_session =
@@ -659,6 +662,32 @@ ngx_stream_upstream_free_round_robin_pee
 }
 
 
+static void
+ngx_stream_upstream_notify_round_robin_peer(ngx_peer_connection_t *pc,
+void *data, ngx_uint_t type)
+{
+ngx_stream_upstream_rr_peer_data_t  *rrp = data;
+
+ngx_stream_upstream_rr_peer_t  *peer;
+
+peer = rrp->current;
+
+if (type == NGX_STREAM_UPSTREAM_NOTIFY_CONNECT
+&& pc->connection->type == SOCK_STREAM)
+{
+ngx_stream_upstream_rr_peers_rlock(rrp->peers);
+ngx_stream_upstream_rr_peer_lock(rrp->peers, peer);
+
+if (peer->accessed < peer->checked) {
+peer->fails = 0;
+}
+
+ngx_stream_upstream_rr_peer_unlock(rrp->peers, peer);
+ngx_stream_upstream_rr_peers_unlock(rrp->peers);
+}
+}
+
+
 #if (NGX_STREAM_SSL)
 
 static ngx_int_t
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel