[Zope-dev] Single-threaded Zope

Casey Duncan casey@zope.com
Fri, 22 Nov 2002 09:49:41 -0500


The solution to your problem is to use ZEO. This allows any number of Zop=
e=20
application servers to share a single ZODB storage. The app servers and=20
storage server do not need to be on the same machine, just connected via =
a=20
local network.

This is the standard way to make Zope scale for large applications.

To solve your use, you would just run each Zope app server single threade=
d.=20
You could run as many of these single threaded, identical Zope app server=
s as=20
you like. You would then need some sort of load balancer in front of it.=20
Although I haven't used it myself, there is a python-based software load=20
balancer named Pound that could be used. There are also various other=20
software and hardware load balancers available.

In general though running many single threaded Zopes will be more resourc=
e=20
intensive then running fewer multi-threaded Zopes. OTOH, running it this =
way=20
would be potentially beneficial when running on a multi-CPU machine due t=
o=20
the Python global interpreter lock.

hth,

-Casey

On Friday 22 November 2002 08:45 am, Carlo Giomini wrote:
> Dear all,=20
> because of reasons that would be boring to explain,I have the following=
=20
> requirement for my site:=20
> I need Zope NOT to run as a single-process multithreaded application (a=
s
> 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 databas=
e.
>=20
> 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-threa=
ded
> processes) and a sort of dispatcher process (proxy server?) that listen=
s
> 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 (numbe=
r
> of requests per second). Is there any way to do so without having to
> implement the dispatcher (proxy) process from scratch?
>=20
> 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?
>=20
> 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 client=
s
> dynamically (to scale according to the load of incoming requests) or
> rather they can only be installed 'statically' (not at run-time, I mean=
).
>=20
> Thanks in advance for any help you can give, regards,
>         Carlo.
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>=20