Welcome! Log In Create A New Profile

Advanced

[PATCH 03 of 15] Workaround for cpu hog on errors with cached connections

Maxim Dounin
September 04, 2011 07:46AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1314894208 -14400
# Node ID aab344fc305b4447f03461e04c1de291cce6caf9
# Parent 028614c84148775551b669785a1b4d637b831678
Workaround for cpu hog on errors with cached connections.

Just doing another connect isn't safe as peer.get() may expect peer.tries
to be strictly positive (this is the case e.g. with round robin with multiple
upstream servers). Increment peer.tries to at least avoid cpu hog in
round robin balancer (with the patch alert will be seen instead).

This is not enough to fully address the problem though, hence TODO. We
should be able to inform balancer that the error wasn't considered fatal
and it may make sense to retry the same peer.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2812,6 +2812,10 @@ ngx_http_upstream_next(ngx_http_request_
if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) {
status = 0;

+ /* TODO: inform balancer instead */
+
+ u->peer.tries++;
+
} else {
switch(ft_type) {


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 00 of 15] upstream keepalive patch queue

Maxim Dounin 1954 September 04, 2011 07:46AM

[PATCH 01 of 15] Correct SSL shutdown handling

Maxim Dounin 864 September 04, 2011 07:46AM

[PATCH 02 of 15] Proper setting of read->eof in pipe code

Maxim Dounin 843 September 04, 2011 07:46AM

[PATCH 03 of 15] Workaround for cpu hog on errors with cached connections

Maxim Dounin 894 September 04, 2011 07:46AM

[PATCH 04 of 15] Upstream: separate pool for peer connections

Maxim Dounin 895 September 04, 2011 07:46AM

[PATCH 05 of 15] Upstream: content_length_n API change

Maxim Dounin 1091 September 04, 2011 07:46AM

[PATCH 06 of 15] Upstream: r->upstream->length type change to off_t

Maxim Dounin 787 September 04, 2011 07:46AM

[PATCH 07 of 15] Upstream: pipe length and input_filter_init in buffered mode

Maxim Dounin 900 September 04, 2011 07:48AM

[PATCH 08 of 15] Upstream: keepalive flag

Maxim Dounin 821 September 04, 2011 07:48AM

[PATCH 09 of 15] Keepalive support in memcached

Maxim Dounin 792 September 04, 2011 07:48AM

[PATCH 10 of 15] Keepalive support in fastcgi

Maxim Dounin 966 September 04, 2011 07:48AM

[PATCH 11 of 15] Upstream: process Transfer-Encoding header and detect chunked one

Maxim Dounin 915 September 04, 2011 07:48AM

[PATCH 12 of 15] Upstream: process Connection header and detect close token

Maxim Dounin 887 September 04, 2011 07:48AM

[PATCH 13 of 15] Protocol version parsing in ngx_http_parse_status_line()

Maxim Dounin 875 September 04, 2011 07:48AM

[PATCH 14 of 15] Proxy: basic HTTP/1.1 support (including keepalive)

Maxim Dounin 1016 September 04, 2011 07:48AM

[PATCH 15 of 15] Upstream keepalive module

Maxim Dounin 962 September 04, 2011 07:48AM

Re: [PATCH 00 of 15] upstream keepalive patch queue

Maxim Dounin 757 September 05, 2011 01:56PM

Re: [PATCH 00 of 15] upstream keepalive patch queue

splitice 1202 September 06, 2011 01:46AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 240
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready