Nginx and php (fast-cgi) hangs the connection

Hello
from about month (moving to the nginx 7.61) I had a very big problem.
My server suddenly stops to serving dynamic content.
Static files are handled in regullar way but asking for php files gives
nothing in the web browser, and sometimes in the benchmarking site in ab
we receive broken sockets.
Some days ago I had moved to 7.62 and spawn-cgi 1.6.3 - then I thought
everything is solved, but I realized that site hangs in the peak of the
site.
There is nothing in the nginx logs, nothing in php logs.
What could I do?
What could be wrong?
Could You help me somehow?

Best regards
YacentY

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,14052,14052#msg-14052

In my past experience usually its just because all the spawned php
processes
are doing something (or are just some hanged state (you could use
‘strace’
to see what the php childs are doing at the moment nginx stops to
deliver
the php content)) and there is no free child to assign the incoming
dynamic
request from nginx.

And while you may think that from php side the ini setting
‘max_execution_time’ would help it is not always the case (especially if
you
are dealign with sockets or other (tcp) connections within the php code)

sooner or later all the childs are being used and no new spawned.

The thing to do would be instead of spawn-cgi use php-fpm
http://php-fpm.org

While it involves patching php (then again it is planned to implement as
core in future php releases (there is even a seperate branch in php.net
svn)) it gives you the possibility http://php-fpm.org/Configuration_File
to
monitor ( request_slowlog_timeout ) and kill ( request_terminate_timeout
)
the php processes which take too long to finish.

Has helped me a lot to find site bottlenecks and point those out to
development team.

rr

----- Original Message -----
From: “yacenty” [email protected]
To: [email protected]
Sent: Thursday, October 15, 2009 8:45 PM
Subject: nginx and php (fast-cgi) hangs the connection

is it a good idea to switch to different solution if the server is not
stable now?
I’m really afraid of this step

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,14052,14122#msg-14122

What do you mean by ‘not stable’?
Your nginx error log (or php error log in case its some fatal php error
but
display_errors is set to false) should show why are there blank pages on
the
dynamic content requests (like fastcgi upstream taking too long to
respond).Anyways most likely your problems have no direct relation to
nginx
at all rather then the php fastcgi childs.

And people do switching just because the current solution for some
reasons
(bugs / too complex / missing features etc) doesnt work.

rr

----- Original Message -----
From: “yacenty” [email protected]
To: [email protected]
Sent: Friday, October 16, 2009 12:57 AM
Subject: Re: nginx and php (fast-cgi) hangs the connection

could be so that You are right
reduced ammount of php processes to 3 and server hang after 30 seconds
with about 300 users online.
Then moved these ammount of processes to 100 and it’s allive
I would provide more data after “peak time”

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,14052,14968#msg-14968

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs