Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible for NGINX to have a pool of N open connections to backend?

Tags:

nginx

pool

trying to use NGINX as reverse proxy, and would like to have constant number of open connections to backend (upstream) open at all times.

Is this possible with nginx (maybe haproxy..?) ??

running on ubuntu if it makes any difference

like image 403
Arieh Leviav Avatar asked Oct 23 '25 20:10

Arieh Leviav


1 Answers

Something like that can be done easily with haproxy. The end result will be that there are no more than N concurrent connections to a backend server + open connections are shared between requests coming from different clients.

backend app
  http-reuse safe
  server server1 127.0.0.1:8080 maxconn 32
  server server2 127.0.0.2:8080 maxconn 32

The example shows 2 servers, haproxy will not open more than 32 connection to each server, and each connection can be shared between several clients whenever that can be done safely.

like image 105
Tair Avatar answered Oct 26 '25 17:10

Tair