[Zope-Perl] Benefits of Zope multithreading

Jim Fulton jim@digicool.com
Mon, 04 Sep 2000 15:36:00 -0400


Gisle Aas wrote:
> 
> I am trying to evaluate what the current single lock that protects the
> perl interpreter means to Zope's performance when running PerlMethods.
> 
> But, I don't really understand what the multithreading buys us in the
> first place.  What is it that actually works better given the Zope is
> multithreaded?  Is there any design documents I can look at?
> 
> The single python lock seems to mean that Zope can't really manage to
> utilize multiple CPUs anyway and the Medusa framework should make sure
> Zope can deal with multiple slow clients even without threads.

By being multi-threaded, Zope allows multiple requests to be handled
simultaneously.  This is a big win, because a long-running request
(e.g. database pack, catalog reindex, slow SQL query, etc.) won't
block short requests.

Under normal situations, where effectively all the computation is
done in Python, then Python's global interpreter lock prevents us
from taking good advantage of multiple processors. Oh well, we still
get concurrency, which is the main thing we want.

Note that in applications that spend a good bit of time
outside the Python interpreter, lots of computation is not
bound by the global interpreter lock. For example, a Zope app
that makes alot of calls to an RDBMS gets alot of advantage.
A thread can be executing the interpreter while other threads
are blocking on database calls.

Still, if we want to take advantage of multiple processors, we'll
use ZEO to run multiple Zope processes.

Jim


--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.