<br><br><div class="gmail_quote">On Wed, Mar 4, 2009 at 11:51 AM, mike <span dir="ltr">&lt;<a href="mailto:mike503@gmail.com">mike503@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Wed, Mar 4, 2009 at 9:03 AM, Roger Hoover &lt;<a href="mailto:roger.hoover@gmail.com">roger.hoover@gmail.com</a>&gt; wrote:<br>
<br>
&gt;&gt;  - dynamic pool size management (keep 1-5 running depending on load;<br>
&gt;&gt;   this will require congestion notifications from the web server, like<br>
&gt;&gt;   you said)<br>
&gt;<br>
&gt; Functionality was recently added to supervisord to modify it&#39;s configuration<br>
&gt; dynamically through the XML-RPC api so this is matter of implementing the<br>
&gt; load logic in an nginx plugin and making calls to supervisord to add and<br>
&gt; subtract from the pool.<br>
<br>
</div>While I would like to keep my software stack low, this sounds like a<br>
neat benefit. Would just need to define hard upper limits, and how<br>
long to wait or whatever to kill spare/unused children (like apache, I<br>
suppose)<br>
<br>
Personally I would like to see a daemon that does this in itself.<br>
Leverages the fcgiwrap code + adds on features. I suppose it would<br>
have to be &#39;aware&#39; of how many connections it was servicing per pool<br>
which Grzegorz makes it sound like can be very hard... but then it<br>
could manage things dynamically.<br>
<br>
request comes in -&gt; depending on what port/socket/etc. it checks the<br>
pool, determines if any children are open (if more needed, spawn like<br>
apache, maybe log a notice in the log), changes to proper uid/gid if<br>
configured, then executes the fastcgi stuff, if it gets back an error,<br>
determine whether or not to log it, pass it back with the same http<br>
code, do both, etc.. </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
etc.</blockquote><div><br>The approach you describe assumes that the parent process can intercept socket connections as they come in.  I don&#39;t think this is possible within the constraints of the FastCGI spec.  Each FastCGI process is forked with file descriptor 0 pointing to a shared FastCGI socket and each child process just calls accept() on that socket.  The OS is responsible to determining which process in the pool accepts each request so there&#39;s no way for the parent process to keep track of which child is taking which request.  Unless that information can be retrieved from the kernel, I think the only place that load logic can be implemented is in an nginx module.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
I don&#39;t understand enough about sockets, C, threading/forking/event<br>
models/etc. to see if that is even an option but it seems like it<br>
could be done, just not sure if it would be way too slow or not?<br>
<br>
</blockquote></div><br>