[Zope] Zope and Dual-CPU machines.

Michel Pelletier michel@digicool.com
Sat, 25 Dec 1999 23:21:37 -0500


chas wrote:
> 
> Does Zope run better on dual-processor machines ?
> (using FreeBSD or Linux).

No exauhstive benchmarking has been done.

> ps. Just as a slightly off-topic question, this has made
>     me wonder : If you have a dual processor machine, what
>     needs to be changed in an application to make it "dual
>     processor compatible ?" Or should the OS take care of
>     all of that and do the load-balancing between the CPU's ?
>     I guess that I won't have to change my Zope application
>     at all ... just leave Zope to work it out. But I'm also
>     creating some Python scripts to handle RPC services...
>     or will the underlying Python interpreter handle all of
>     that without me having to know ?

There are many issues here.  If the program is 'multi-process' (ie,
composed of multiple processes in seperate process spaces, like Apache)
the the OS will handle scheduling processes on different processors.  if
the program is 'multi-threaded' (like Zope and Zeus) then the OS will
also handle scheduling of threads on multiple processors, as long as
none of the threads are blocking each other with things like locks and
semaphores.  If a program is single threaded (like ZServer or squid)
then it will only ever run on one processor at one time (there is no
saying that that OS cannot move that one processes *between* processors,
however).

There is one caveat with Zope.  Zope is multi-threaded, but the Python
interpreter has one large global lock that does not allow multiple
threads to run python code simultaneously.  Now, lots of C code in Zope
and the DAs and various python modules do "release" this lock when
apropriate, but generally, interpreted python byte-code is serialized
and only one thread of execution can run at one time regardless of the
number of processors.

So two processors will help some, but more than that probably won't. 
Further, with two processors you won't find a "doubling" in
performance.  "Fixing" this is beyond the scope of Zope; it is a Python
issue.  There is work being done on different projects to address this
issue.

I remember someone quoting someone else on this list (I think it was AMK
or Aaron Watters doing the quoting... I forget who was quoted).  The
gist of the quote is that multi-threaded programming is very, very
hard.  There are all kinds of little goblins and gotchas hiding in what
can apear to be very straight forward coding.

-Michel