number of keepalive connections to an upstream

Sébastien Rebecchi srebecchi at kameleoon.com
Mon Mar 18 13:41:50 UTC 2024


Hello,

What is the good rule of thumbs for setting the number of keepalive
connections to an upstream group?

1. https://www.nginx.com/blog/performance-tuning-tips-tricks/
in this blog, the writer seems to recommend a constant value of 128, no
real explanation why it would fit whatever the number of servers in the
upstream

2. https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
the upstream module doc seems to recommend a rule like 16 times the number
of servers in the upstream, as we have two examples with respectively
keepalive 32 for 2 upstream servers and keepalive 16 for 1 upstream server

3.
https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#no-keepalives
in this blog, the writer recommends a rule of 2 times the number of servers
in the upstream

I used to follow rule of item 3 as it comes with a somewhat good
explanation, but it does not seem to be largely accepted.

What could explain such a divergence between several sources? What would
you recommend please?

Regards,

Sébastien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20240318/01787259/attachment.htm>


More information about the nginx mailing list