[FASTCGI] FastCGI spec question

Bo Lindbergh blgl at hagernas.com
Sun Oct 11 12:36:39 EDT 2009

2009-10-11 kl. 07.00 skrev David Bender:

> Hey,
>   I am working on a FastCGI implementation and encountered an  
> ambiguity in the spec.
> Section 4.1 says:
> #  FCGI_MAX_CONNS: The maximum number of concurrent transport  
> connections this
> application will accept, e.g. "1" or "10".
> # FCGI_MAX_REQS: The maximum number of concurrent requests this  
> application will
> accept, e.g. "1" or "50".
>  I am assuming that PER CONNECTION, the web server will use Request  
> Id range [1
> - FCGI_MAX_REQS] (Is this correct?).

There's no hard guarantee for the range.  The spec only says
"The Web server attempts to keep FastCGI request IDs small."

> Consequently, the application must then
> handle (FCGI_MAX_CONNS * FCGI_MAX_REQS) concurrent requests, which  
> violates the
> definition of FCGI_MAX_REQS.

FCGI_MAX_REQS is always per application, not per connection.
If the web server balances requests over connections, expect
FCGI_MAX_REQS/FCGI_MAX_CONNS concurrent requests per connection.

>  Or am I to assume that the web server partitions the Request ID  
> space among its
> active connections?

The request id space is always per connection, not per application.

> However there could be multiple web servers talking the same
> CGI app this would seem difficult to coordinate.

The spec doesn't address the case of multiple un-coordinated web
servers talking to the same application.  At a minimum, the application
would need to apply a scale factor: actually accepting N times
the number of connections/requests it claims to accept.

/Bo Lindbergh

More information about the FastCGI-developers mailing list