Le 09/11/2020 à 15:38, Christopher Faulet a écrit :
Le 06/11/2020 à 19:56, Harris Kaufmann a écrit :
Hi everyone,

I wanted to try the FastCGI multiplexing feature, but whatever I do HAProxy
never sends multiple requests simultaneously over the same backend connection.
This is my configuration:

------------------------------------------------------------------------------

defaults
      mode http
      timeout connect 5000ms
      timeout client 50000ms
      timeout server 50000ms


backend fastcgi
      server server0 127.0.0.1:9002 <http://127.0.0.1:9002> proto fcgi maxconn 1
      use-fcgi-app fcgi-app

fcgi-app fcgi-app
      docroot /
      option mpxs-conns
      option max-reqs 20
      no option get-values

frontend web
      bind *:8080
      default_backend fastcgi

------------------------------------------------------------------------------

When I send multiple HTTP requests that overlap, Haproxy just executes them
serially with new backend connections for each request (because of maxconn) and
most of them time out. Is my configuration wrong? Did I misunderstand this 
feature?


You must first be sure you FCGI application support the connection multiplexing.
For instance, php-fpm is unable to do so. Then, the "maxconn" on a server line
in HTTP mode will limit the number of concurrent requests. Not the number of
concurrent connections. From the doc :

    maxconn <maxconn>

    [...]
    In HTTP mode this parameter limits the number of concurrent requests instead
    of the number of connections. Multiple requests might be multiplexed over a
    single TCP connection to the server. As an example if you specify a maxconn
    of 50 you might see between 1 and 50 actual server connections, but no more
    than 50 concurrent requests.

Thus, you should set maxconn to 20 (same than max-reqs FCGI option). But, this
way you should be prepared to open at most 20 connections.

Note also, since the 2.3, if you use the http-reuse safe method (the default), the multiplexing is only performed for streams of the same session. It means, in safe mode, there is no sharing between several clients.

--
Christopher Faulet

Reply via email to