[FASTCGI] FastCGI Expert Sought
Matthew Weigel
unique at idempot.net
Fri Jul 17 01:28:50 EDT 2009
Ross Richey wrote:
> So yes this might be something which needs to be handled at the Lighttpd
> level. But before we do that I just want to ask the conceptual question:
>
> Is there some method of nicely killing and respawning a FastCGI process?
I run lighttpd on my personal server and do my personal web development
as FastCGI; however, I don't rely on lighttpd's process management
functionality to do it[1].
If you do use lighttpd's own process management (e.g., specifying in
lighttpd.conf the 'bin-path' for a FastCGI process)... first of all,
have you looked at
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModFastCGI ?
You should be able to set a minimum number of processes, and a maximum
number of processes, for that FastCGI server. I *think* - but again, I
don't use this part of lighttpd myself - that if you simply configure
your Perl program to exit after handling X number of requests, lighttpd
will spawn new processes once the number of remaining processes drops
below the minimum.
PHP has the functionality you're asking about (each child process dies
after X requests) built in, without needing to be spawned/managed by
lighttpd, and I wrote a small Perl application that does it as well.
The traffic I get for this particular web app is minimal, so I've never
needed to take the PHP approach of having a master process that manages
multiple children who occasionally restart; it's definitely possible though.
> The reason I asked for an expert and offered money is that we're fully
> expecting that we might have to get someone to actually add that
> functionality to FastCGI, but obviously I'm open to other ideas on
> fixing the problem.
Attached is the skeleton of the Perl application I wrote, minus the
actual HTML generation, form handling, etc. It might help with writing
a Perl FastCGI server that isn't managed directly by lighttpd. You
might have an easier time simply changing your existing code to exit
after X requests, but both options are worth considering. It works for
me, but that's no guarantee. :-)
1. I do quite a bit to separate privileges and functionality; I have
lighttpd configured to chroot itself to /var/www and drop root
privileges when it starts, and for example PHP is spawned via lighttpd's
spawn-fcgi in a more restrictive chroot (like
/var/www/first.example.net/) as a more restricted user.
--
Matthew Weigel
hacker
unique & idempot . ent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo_srv.pl
Type: application/x-perl
Size: 3362 bytes
Desc: not available
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20090717/72eacd45/attachment.bin>
More information about the FastCGI-developers
mailing list