Welcome! Log In Create A New Profile

Advanced

Re: what does fastcgi_keep_conn do?

B.R.
March 21, 2015 06:46AM
'Keep connection' does not mean what you think it means.

That does not tie a client connection to a backend connection. To do that,
you will need stuff like ip_hash
<http://nginx.org/en/docs/http/ngx_http_upstream_module.html#ip_hash> or
more advenced session mechanisms (which are sadly not available in FOSS...
yet?).

Read the docs on fastcgi_keep_conn
<http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_keep_conn>,
which says it ensures the FastCGI connection is not close after being used,
which is the normal way of doing it. Use that in relation with keepalive
<http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive>, as
instructed.

That means that connections to the backend will remain open after being
open, so the next time the webserver addresses to them, they won't need to
open a new connection to them.
---
*B. R.*

On Fri, Mar 20, 2015 at 10:25 PM, nginxuser100 <nginx-forum@nginx.us> wrote:

> Hi, I would like nginx to serve all requests of a given TCP connection to
> the same FCGI server. If a new TCP connection is established, then nginx
> would select the next UDS FCGI server in round-robin fashion.
>
> Can this be achieved with NGINX, and if yes, how?
>
> I thought turning on fastcgi_keep_conn on would achieve this goal, but it
> is
> not what happened. My obervation was that each FCGI server took turn
> receiving a new request even if all the requests are from the same TCP
> connection.
>
> I had:
>
> upstream backend {
> server unix:/tmp/fastcgi/socket1 ...;
> server unix:/tmp/fastcgi/socket2 ...;
> keepalive 32;
> }
>
> server {
> ...
> location <uri> {
> fastcgi_keep_conn on;
> fastcgi_pass backend;
> }
>
> Thank you.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,257508,257508#msg-257508
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

what does fastcgi_keep_conn do?

nginxuser100 March 20, 2015 05:25PM

Re: what does fastcgi_keep_conn do?

B.R. March 21, 2015 06:46AM

Re: what does fastcgi_keep_conn do?

nginxuser100 March 23, 2015 08:43PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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