upstream keepalive connections for all servers or each server?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

upstream keepalive connections for all servers or each server?

rnburn
Hi

As known, the keepalive directive can activate the connections cache for
upstream servers. I know the connection pool is in each worker process. But
I'ms confused that the connection number is for each upstream server or is
shared for all servers? It's documented at
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive 

Thanks
Xiaofeng

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274098,274098#msg-274098

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: upstream keepalive connections for all servers or each server?

Maxim Dounin
Hello!

On Mon, May 08, 2017 at 04:24:59AM -0400, fengx wrote:

> As known, the keepalive directive can activate the connections cache for
> upstream servers. I know the connection pool is in each worker process. But
> I'ms confused that the connection number is for each upstream server or is
> shared for all servers? It's documented at
> http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive 

It is the number of keepalive connections to be cached for the
whole upstream{} block, that is, all servers.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: upstream keepalive connections for all servers or each server?

Robert Paprocki

It is the number of keepalive connections to be cached for the
whole upstream{} block, that is, all servers.

Can we clarify the behavior for upstreams with duplicate server directives? Consider the following

upstream foo {
 server 1.2.3.4:80;
 server 5.6.7.8:80;

 keepalive 32;
}

upstream bar {
 server 1.2.3.4:80;
 server 5.6.7.8:80;

 keepalive 32;
}

A max of 64 TCP connections will be kept open?

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: upstream keepalive connections for all servers or each server?

Maxim Dounin
Hello!

On Wed, May 10, 2017 at 05:40:55PM -0700, Robert Paprocki wrote:

> > It is the number of keepalive connections to be cached for the
> > whole upstream{} block, that is, all servers.
>
> Can we clarify the behavior for upstreams with duplicate server directives?
> Consider the following
>
> upstream foo {
>  server 1.2.3.4:80;
>  server 5.6.7.8:80;
>
>  keepalive 32;
> }
>
> upstream bar {
>  server 1.2.3.4:80;
>  server 5.6.7.8:80;
>
>  keepalive 32;
> }
>
> A max of 64 TCP connections will be kept open?

Yes, in such a configuration each upstream block will cache up to
32 connections (per worker process).

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: upstream keepalive connections for all servers or each server?

rnburn
nice. it's clear. thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274098,274214#msg-274214

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: upstream keepalive connections for all servers or each server?

rnburn
In reply to this post by Maxim Dounin
hi,

how nginx determines idle connections? is keepalive adaptable with
websocket?
will "proxy_ignore_client_abort off" setting exclude keepalive function?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274098,275484#msg-275484

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx