Welcome! Log In Create A New Profile

Advanced

Re: Upstream Keepalive Questions

Maxim Dounin
April 08, 2014 05:28AM
Hello!

On Mon, Apr 07, 2014 at 05:29:15PM -0400, abstein2 wrote:

> I'm somewhat unclear about how the keepalive functionality works within the
> upstream module. My nginx install currently handles several hundred domains
> all of which point to different origin servers. I would imagine I can
> improve performance by enabling keepalive, however the documentation says
> "The connections parameter sets the maximum number of idle keepalive
> connections to upstream servers that are preserved in the cache of each
> worker process. When this number is exceeded, the least recently used
> connections are closed. "
>
> Does that mean that if I have 10 domains and then set keepalive to 32, that
> there will potentially be up to 320 open connections from my server to the
> backend servers per worker at any given point or would the worker share all
> upstreams and only open a total of 32 regardless of how many upstream blocks
> were on the website? Also, does the number of keepalive connections have
> anything to do with the number of cores on a box?

Each upstream block has it's own connection cache. There is no
"generic" connection cache to be used with all upstream blocks.

> Also, is there any downside to having a large number of upstreams in the
> http block? I know for "map" block there's no performance degradation since
> they're only evaluated on demand, but I don't see any kind of documentation
> regarding how upstreams are handled.

Unless you use variables to dynamically select an upstream server, it
is resolved while parsing configuration and there is no performance
degradation at runtime regardless of the number of upstream blocks you
have.

--
Maxim Dounin
http://nginx.org/

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

Upstream Keepalive Questions

abstein2 April 07, 2014 05:29PM

Re: Upstream Keepalive Questions

Maxim Dounin April 08, 2014 05:28AM

Re: Upstream Keepalive Questions

abstein2 April 08, 2014 05:41PM

Re: Upstream Keepalive Questions

Maxim Dounin April 09, 2014 07:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
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