<html><body bgcolor="#FFFFFF"><div>Hmm. Well&nbsp;<br><br>On Mar 4, 2009, at 12:34 PM, Roger Hoover &lt;<a href="mailto:roger.hoover@gmail.com">roger.hoover@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><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"><a href="mailto:mike503@gmail.com">mike503@gmail.com</a></a>></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"><a href="mailto:roger.hoover@gmail.com">roger.hoover@gmail.com</a></a>> wrote:<br>
<br>
>> &nbsp;- dynamic pool size management (keep 1-5 running depending on load;<br>
>> &nbsp; this will require congestion notifications from the web server, like<br>
>> &nbsp; you said)<br>
><br>
> Functionality was recently added to supervisord to modify it's configuration<br>
> dynamically through the XML-RPC api so this is matter of implementing the<br>
> load logic in an nginx plugin and making calls to supervisord to add and<br>
> 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 'aware' 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 -> 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..&nbsp;</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.&nbsp; I don't think this is possible within the constraints of the FastCGI spec.&nbsp; 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.&nbsp; The OS is responsible to determining which process in the pool accepts each request so there's no way for the parent process to keep track of which child is taking which request.&nbsp; 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>
&nbsp;</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'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>
</div></blockquote></body></html>