[Zope] Options for handling concurrency?

Tony McDonald tony.mcdonald@ncl.ac.uk
Tue, 29 Feb 2000 14:20:53 +0000


At 3:54 pm -0800 28/2/00, Michel Pelletier wrote:
>
>  > Aye carumba! - what a lot of information. I'm going to start delving
>>  around there and see what happens. Is there any additional
>>  documentation available on what the info. means?
>
>Nope.
>
>  > As an aside (to the list), looking around the ApplicationManager.py
>>  reveals something called manage_profile. It looks like the main Zope
>>  functions are being profiled here (ie not at the object level). It's
>>  interesting, but it does seem to be a resource hog...
>
>Profiling is turned off by default.  You're right though, when it's
>turned on it does slow down Zope considerably.  But it shouldn't matter
>because that isn't documented either.

Thanks for the reply,
I get it. "Here be Dragons", fair enough.

>  > I do use caching Martijn, but I must admit that it's been a hit and
>>  miss affair.
>
>har har...

I didn't realise what I was typing was a pun...  I meant that I have 
caches set at 1000 rows, 1000 results and 600 seconds on the main 
ZSQL queries, but I don't have a way of testing to see if it's having 
any effect (see below),

>  > I'm trying to do as many of my SQL queries in external
>>  methods (ironically for the performance), so I may well be losing a
>>  lot of the caching performance breakthrough there .... hmmm. I wonder
>>  if I could do something like...
>
>There really should be very, very little performance difference between
>calling ZSQL methods from DTML and from an external method.  Have you
>notice an significant speedup do to this?  If so, we should look at
>that...
>
>-Michel

My methods are more complex than simple ZSQL lookups. I need to do a 
tree traversal through a database to get the relevant items to 
display. So I need to do nested SQL queries.The first Zope attempt 
was ;

<dtml-var standard_html_header>
<dtml-if child><dtml-var show_html>
<dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html>
<dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html>
<dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html>
<dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var 
show_html></dtml-in get_children L4></dtml-in get_children 
L3></dtml-in get_children L2></dtml-in get_children L1>
<dtml-else>
<form action='cascade2' method=post>
child <input type=text name=child size=10>
</form>
</dtml-if>
<dtml-var standard_html_footer>

That is, it's a nested loop of ZSQL methods and show_html is an 
external method that displays HTML dependant on the contents of a 
DTML document in the ZODB (this is *so* cool - I can change the look 
and feel of 'elements' with triviality...)
It took about 27 seconds to render a (120k) document.

Using a full External Method solution, with calls to DBH.query (and a 
one-time lookup for all the DTML 'templates' in the ZODB) it took 
about 2 seconds (it's not completely debugged though! :).

So, I'm *not* calling ZSQL methods from an External method, I'm using 
direct connections to the database using Python libraries. Obviously, 
I lose a lot of Zope goodies here, but I really need that speedup...

Thanks for the thoughts,
Tone
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2