
boteeka at yahoo
Mar 2, 2010, 3:44 AM
Post #16 of 17
(1066 views)
Permalink
|
|
Re: 504 Gateway timeouts under minimal load
[In reply to]
|
|
This is for nginx / lighttpd but probably is valid for Cherokee too: http://blog.taragana.com/index.php/archive/how-to-stop-crashing-hanging-of-php-cgi-spawn-fcgi-with-nginx-lighttpd/ ----- Original Message ---- From: Alvaro Lopez Ortega <alvaro [at] octality> To: Ryan McIntosh <thebigslide [at] gmail> Cc: cherokee [at] lists Sent: Thu, February 18, 2010 4:50:34 PM Subject: Re: [Cherokee] 504 Gateway timeouts under minimal load Hello Ryan, “Been there, did that..” :-) Actually, it isn't that easy. There are quite a few additional cases to take into account. For instance: the PHP interpreter may require up to ~5 seconds to get started (it's got a whole lot of dependencies to initialize). What would happen in a high load server? Let's suppose it takes 1sec to php-cgi to open the TCP port, and that your server has 100 hits/sec. It'd spawn 100 copies of php-cgi of which 99 would fail to initialize. This is the current code (it isn't trivial to understand): http://svn.cherokee-project.com/browser/cherokee/trunk/cherokee/source_interpreter.c http://svn.cherokee-project.com/browser/cherokee/trunk/cherokee/spawner.c http://svn.cherokee-project.com/browser/cherokee/trunk/cherokee/main.c#L345 Comments, thoughts and improvement proposals are always welcome! On 18/02/2010, at 15:34, Ryan McIntosh wrote: > Another catch is if there's an interpreter already listening and all the interpreters' worker threads are busy - the interpreter will refuse the connection and the spawn will fail because there's a process listening on that port already. > > Perhaps an option to send a configurable signal would be helpful. One could then write a wrapper script to catch signal X and 'do stuff' - even if that just amounts to logging that the administrator should be increasing the number of interpreter threads. > > So the logic could be if there's a live PID, send it the signal - if there's no PID or the process has ended, respawn. > > Ryan > > On Thu, Feb 18, 2010 at 4:48 AM, Alvaro Lopez Ortega <alvaro [at] octality> wrote: > On 18/02/2010, at 11:28, Alejandro Barrera wrote: > > On Thursday 18 February 2010 11:22:27 Juan J." Martínez wrote: > >> El mar, 16-02-2010 a las 03:47 -0800, Szász Botond escribió: > >>> [...] > >>> As for the minimal load, this is happening on my dev machine where only I > >>> am using the webserver at a rate of about max. 10 request per minute. > >>> > >>> Ideas? Suggestions? > >> > >> Hi, > >> > >> How many PHP processes hare you spawning? If you have only one process > >> for PHP (with children serving stuff), when the only one PHP process is > >> busy you will get that error (if I recall correctly, I have the same > >> problem at first). > >> > >> Check this: > >> > >> http://www.fastcgi.com/archives/fastcgi-developers/2009-April/000230.html > > > > Because this is happening a lot, maybe having an autospawn option might be a good idea ;) What do you think about it? > > Cherokee does, in fact, spawn processes if needed. Basically, it launches a new process whenever it cannot contact the PHP interpreter (the connection is refused), that's a piece of cake. However, the tough scenario here is when the connection is accepted, but the php interpreter is frozen. In that case, there is nothing Cherokee can do but to deactivate the source. > > -- > Octality > http://www.octality.com/ > > _______________________________________________ > Cherokee mailing list > Cherokee [at] lists > http://lists.octality.com/listinfo/cherokee > -- Octality http://www.octality.com/ _______________________________________________ Cherokee mailing list Cherokee [at] lists http://lists.octality.com/listinfo/cherokee _______________________________________________ Cherokee mailing list Cherokee [at] lists http://lists.octality.com/listinfo/cherokee
|