Welcome! Log In Create A New Profile

Advanced

Re: keepalive connection to fastcgi backend hangs

Maxim Dounin
December 20, 2021 02:36PM
Hello!

On Mon, Dec 20, 2021 at 04:00:59PM +0000, Nicolas Franck wrote:

> Interesting!
>
> I looks like there is nothing that managing the incoming connections
> for the fcgi workers. Every fcgi worker needs to do this on its own, right?
> So if there are more clients (i.e. nginx workers) than fcgi workers,
> then it becomes unresponsive after a few requests, because all
> the fcgi workers are holding on to a connection to an nginx worker,
> and there seems to be no queue handling this.
>
> Is this correct? Just guessing here

More or less. The FastCGI code in your example implies very
simple connection management, based on the process-per-connection
model. As long as all FastCGI processes are busy, all additional
connections will be queued in the listen queue of FastCGI
listening socket (till a connection is closed). Certainly that's
not the only model possible with FastCGI, but the easiest to use.

The process-per-connection model doesn't combine well with
keepalive connections, since each keepalive connection occupies
the whole process. And you have to create enough processes to
handle all keepalive connections you want to be able to keep
alive. In case of nginx as a client, this means at least (<number
of connections in the keepalive directive> * <number of worker
processes>) processes.

Alternatively, you can avoid using keepalive connections. These
are not really needed for local upstream servers, since connection
establishment costs are usually negligible compared to the total
request processing costs. And this is what nginx does by default.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

keepalive connection to fastcgi backend hangs

Nicolas Franck December 19, 2021 02:58PM

Re: keepalive connection to fastcgi backend hangs

Maxim Dounin December 20, 2021 09:12AM

Re: keepalive connection to fastcgi backend hangs

Nicolas Franck December 20, 2021 11:02AM

Re: keepalive connection to fastcgi backend hangs

Maxim Dounin December 20, 2021 02:36PM

Re: keepalive connection to fastcgi backend hangs

Nicolas Franck December 20, 2021 03:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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