[Zope] Priority of processes in Zope

Matthew T. Kromer matt@zope.com
Tue, 19 Feb 2002 12:44:52 -0500


oliver.erlewein@sqs.de wrote:

> Hi Matthew
>
> Thanx for your answer.
>
> I'm still batteling furiously with Solaris and Zope. As opposed to Win 
> NT / MacOS X / Linux Solaris seems to be running Zope in a single 
> thread. For details see the zope-news-thread on "threading, dtml and 
> performance". You can check this by running a complex dtml-method and 
> trying to access anythin else on that site at the same time. My system 
> freezes for as long as the huge task takes.
>


Well, here's something that you can try:  Twiddle the 
sys.setcheckinterval() value in z2.py.  This effectively sets the Zope 
threading granularity by adjusting the python knob that controls how 
often threads voluntarily release and reacquire their lock.  The smaller 
the number, the more frequently Python will release the lock.  However, 
the smaller you set it, the worse your overall throughput will get, 
since more time will be spent in the thread-switching machinery.

What I suspect will be the problem is that the threading model Python 
was built with may be giving the priority back to the thread that 
released the lock, meaning that you're effectively single-threaded, even 
though you can have multiple threads dispatched.

Inside the Python source code, in Python/thr_solaris.h you'll see the 
section that creates threads on Solaris.

The flags for thr_create() that Python uses are THR_DETACHED, and 
THR_NEW_LWP.  You could *try* fiddling with these flags and recompiling 
Python.    I'm not sure about this, but you could try adding THR_BOUND 
to the flags.  I'm not a Solaris threading guru, so I'm not sure how to 
get it to change its scheduling policy -- however, another thing to try 
would be to try to use pthreads instead of the solaris threads for 
Python; how you tweak the configure script to do this is something I 
dont know off the top of my head, though.

> My Solaris servers:
>
> Zopeserver 1 (Sun R280/4GB Ram/4 CPU's/ Solaris 2.8 - I think /not 
> dedicated)
> Pystone(1.1) time for 10000 passes = 2.03
> This machine benchmarks at 4926.11 pystones/second
>
> Zopeserver 2 (PIII 1Ghz DELL 19"/512Mb Ram/1 CPU/ Solaris 
> 2.7/dedicated Zope)
> Pystone(1.1) time for 10000 passes = 0.85
> This machine benchmarks at 11764.7 pystones/second
>
> That sortof justifies your hunch on what is cheaper (the sun is about 
> 15 times the price of the DELL rack). If you use the server for other 
> programs aswell then the Intel looses the cutting edge due to the one 
> processor.
>
> Oliver Erlewein
>


-- 
Matt Kromer
Zope Corporation  http://www.zope.com/