[Grok-dev] Annotations Usage Pattern
paulalexwilson at gmail.com
Fri Jun 5 12:26:17 EDT 2009
2009/6/5 Wichert Akkerman <wichert at wiggy.net>
> Previously Paul Wilson wrote:
> > Hi Grokkers,
> > I'm writing a system that uses annotations to store metadata about my
> > objects. I'm using the annotations concept as a way of providing an
> > extensible metadata facility. However as I continue to read and learn
> > Zope/Grok - I'm not sure about whether I'm taking the right approach.
> > Looking at code/commentries written by a prominent Grok/Zope member, they
> > advocate only non-extensive usage of annotations, and in their code write
> > meta-data facility which uses containment rather than annotations to
> > the problem.
> > What wisdom on this topic do you have?
> It depends a bit on your application. Annotations are very convenient,
> but they have one downside: annotations are not stored directly on
> the object being annotated but in a BTree on that object. That means
> they are not in the same ZODB object. So instead of loading one object
> from the ZODB you might need to load several objects, which will
> increase latency and cache pressure. Most of the time that is not
> problematic. If you need to scale up to large or high performance
> systems this can become an important factor.
> A rule of thumb: data that is accessed often should be stored in the
> ZODB object, for example via an attribute on the python object.
Okay - so it's just a performance thing. I fear architectural issues more
than performance ones, so that's good. Thanks for your input!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Grok-dev