Nginx Proxy KeepAlive and FastCGI KeepAlive

c0nw0nk nginx-forum at forum.nginx.org
Fri Sep 30 19:34:54 UTC 2016


FastCGI :

upstream fastcgi_backend {
    server 127.0.0.1:9000;

    keepalive 8;
}

server {
    ...

    location /fastcgi/ {
        fastcgi_pass fastcgi_backend;
        fastcgi_keep_conn on;
        ...
    }
}

Proxy :
upstream http_backend {
    server 127.0.0.1:80;

    keepalive 16;
}

server {
    ...

    location /http/ {
        proxy_pass http://http_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        ...
    }
}

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive

So when keeping connections alive for back end processes / servers how is
the keep alive number worked out should I just double it each time I add a
new server into the backend's upstream.

So if I have 100 fastcgi servers in my upstream its just 8x100=800 so my
keepalive value should be keepalive 800; and the same for proxy_pass
upstream 16x100=1600 keepalive 1600;

Or that would be to much and it should not be calculated like this ?

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



More information about the nginx mailing list