[Zope] conflicts, sessions, and programming best practices guidelines

Chris McDonough chrism at plope.com
Tue Nov 15 18:48:22 EST 2005


On Nov 15, 2005, at 5:54 PM, Dennis Allison wrote:

>
> Has anyone prepared a set of best practice guidelines on the  
> techniques to
> use to minimize conflicts?
>
> It is becoming clear that we need to do to refactor some of our  
> code to
> get us out of our current conflict pickle.
>
> A quick google produced lots of commentary but nothing I could hand  
> to our
> programmers as guidelines.

Nothing in general except the (probably too general) "attempt not to  
allow one process/thread to write to the same object at the same time  
as another process/thread".

One tip, since you've told us you use sessions heavily: using ZEO to  
back your session database provides more opportunity for conflicts  
than if you used a "normal" Zope storage.  This is because:

- the opportunity for conflict naturally grows as transaction time  
increases and using a ZEO storage rather than a local storage adds  
latency to the total transaction time that would not otherwise exist.

- you have "n" processes attempting to write to essentially the same  
objects at the same time when you use a shared ZEO sessioning  
database.  If these were instead local databases, each process would  
only compete "with itself" (between all of its threads).

I tend to try to use local sessioning databases backed by tempstorage  
plus a frontend load balancer that allows for cookie-based session  
affinity (Pound).

- C



More information about the Zope mailing list