> On 26 July 2011 13:57, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> > Hello!
> >
> > Attached patch (against 1.0.5) introduces upstream keepalive
> > support for memcached, fastcgi and http.  Note the patch is
> > experimental and may have problems (though it passes basic smoke
> > tests here).  Testing is appreciated.
> >
> >
> Sounds great. Is it expected to work in this case:
>
>  upstream fastcgi_backend {
>        server unix:/tmp/php-fpm.sock
>        keepalive 32;
>    }

Yes (though I'm not sure if php is able to maintain connections
alive, but quick look suggests it should).

Out of interest I have tested the above (on 1.0.5) under heavy load and I have run into a problem. 40 - 90 seconds after startup all requests start returning 502 and the log is flooded with: 

[error] 2120#0: *37802582 connect() to unix:/tmp/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, [...] upstream: "fastcgi://unix:/tmp/php-fpm.sock:"

I am running php-fpm 0.5.14 with 32 * PHP 5.2.17 processes. 

How long it takes seems to depend on request rate. It looks like the php-fpm listen backlog is overflowing (it's at 8178, but that's normally sufficient when keepalive is disabled).

Likely to be a php-fpm problem? Someone not reusing connections? 

Thomas