[Zope-dev] Single-threaded Zope

Carlo Giomini c.giomini@caspur.it
Fri, 22 Nov 2002 14:45:08 +0100 (MET)


Dear all, 
because of reasons that would be boring to explain,I have the following 
requirement for my site: 
I need Zope NOT to run as a single-process multithreaded application (as
it does by default) but instead to run as a pool of processes (each one
single-threaded); those processes should share the same Data.fs database.

Shutting down the threads is trivial (using setNumberOfThreads function)
but the tricky part (for me, at least) is to keep the ability to serve
many requests concurrently. Since I discarded threads, the only other
way is to have many Zope instances running (as independent single-threaded
processes) and a sort of dispatcher process (proxy server?) that listens
for incoming HTTP connections from the outside world and dispatches it
to one of the Zope instances (performing also the reverse operation,
of course). The dispatcher should also care to create (and destroy)
dynamically the Zope instances, according to the load of traffic (number
of requests per second). Is there any way to do so without having to
implement the dispatcher (proxy) process from scratch?

I have been considering FastCGI as a solution, since it allows a web
server (say Apache) to spawn many persistent processes to execute
the CGI requests it receives but, to my disappointment, I noticed
that the mod_fastcgi directive used in all the howtos on the subject
is FastCgiExternalServer, which does not allow for the CGI app to be
created by Apache itself. FastCgiExternalServer relies on a 'manual'
external starting of the CGI app, which can only be ONE process then!
There's another directive (FastCgiConfig) that lets Apache spawn the
process(es) that execute the CGI app, the question is: can it be used
with Zope instead of FastCgiExternalServer? Since (Fast)CGI apps use
pipes to communicate with the web server (when they run on the same
machine), the problem becomes how to pass a web request directly to
the Zope publishing mechanism over a pipe, bypassing the Zope's HTTP
server. How can I do that? Someone out there has ever tried to do so?

Also, how does Zope support having multiple instances of it sharing the
same database (Data.fs)? One solution could be having many ZEO clients on
the same machine, but I wonder if it is possible to create those clients
dynamically (to scale according to the load of incoming requests) or
rather they can only be installed 'statically' (not at run-time, I mean).

Thanks in advance for any help you can give, regards,
        Carlo.