I added FCGIApp and SCGIApp to the (new) flup.client package. I wrote FCGIApp
a few months ago for Ian Bicking's
WPHP. While attempting to debug a problem with flup's fcgi server on Dreamhost (vs. my old fcgi.py module), I thought of an interesting solution.
Since the problem seemed to stem from the app's long startup time, and since Dreamhost only allows dynamic (i.e. web server-launched) FastCGI apps, why not have the web server-started app be as simple as possible and have it forward requests to a static, manually-launched app server?
In other words:
httpd (mod_fastcgi) -> fcgi.WSGIServer -> FCGIApp -> fcgi.WSGIServer -> app
Yeah, it ends up doing some extra work... which is why I wrote SCGIApp (SCGI is a far simpler protocol):
httpd (mod_fastcgi) -> fcgi.WSGIServer -> SCGIApp -> scgi.WSGIServer -> app
Anyway, it's a trade off and I really don't know how significant it is. But I was never really a fan of web server-launched FastCGI apps. Unless you configure mod_fastcgi explicitly, it has a tendency to launch an application multiple times. And if your application isn't multi-process safe
and aware, it can lead to problems.
Consider these two modules experimental for now. I'm not really sure
where I want them to live. But they're there for the time being to play around with.