[Zope-dev] TypesTool speedup

Wichert Akkerman wichert at wiggy.net
Sun Mar 4 07:57:23 EST 2007


I'm forwarding a message from limi here, since it makes much more sense
here than it does on plone-developers. To summarize it: while analying
performance of the Plone 3 codebase they noticed a lot of time was spent
trying to figure out which types could be added at a location. Part of
that logic uses the TypesTool _queryFactoryMethod function, which goes
through the dispatcher to get to the factory method for a type, which is
apparently very slow in Zope 2.10, and much faster in Zope 2.9.

They came up with http://paste.plone.org/13211 which is an imho somewhat
evil approach which introduces a thread-local cache for
App.FactoryDispatcher._product_packages. As described below the speedup
as a result of that is huge.

Since Zope startup is as far as I know the only time the result of
_product_packages is change perhaps it would be useful to generate
that result on speedup. Or perhaps to make _product_packages cache its
output. I certainly do want any monkey patches in Plone for this since
it should be fixed in either Zope or CMF.

Wichert.

----- Forwarded message from Alexander Limi <limi at plone.org> -----

From: Alexander Limi <limi at plone.org>
To: plone-developers at lists.sourceforge.net
Subject: [Plone-developers] Plone 3 - now 3x faster for logged-in users
Date: Sat, 03 Mar 2007 19:37:54 -0800
Message-ID: <op.tona1gssvhba00 at -emo>

Hello from the optimization sprint :)

Just thought I'd keep you updated on some of the stuff we've been up to  
here.

The main news for the day is that we found a combination of slowness in  
Zope 2.10 and CMF using that method in a less-than-optimal way. The result  
was that rendering the content menu (the one that decides what types you  
can add where etc) was eating an amazing amount of time.

Explained in my usual UI designer hand-wavy way, every time we load a page  
in logged in mode, it checks the list of Products to figure out what you  
can add.

So, by caching this locally in TypesTool so it doesn't get looked up every  
time (the list of Products doesn't change with every request, after all),  
we get a significant speedup.

Let's see some numbers of loading the front page of a fresh plone :

Before types tool optimization (10 requests):
Products/CMFPlone/skins/plone_content/document_view.pt 8.54s
lib/python/plone/app/contentmenu/contentmenu.pt        6.26s

After types tool optimization:
Products/CMFPlone/skins/plone_content/document_view.pt 2.55s
lib/python/plone/app/contentmenu/contentmenu.pt        0.29s

That makes every logged in page over 3 times faster. I like it. :)

Patch for CMFCore TypesTool included.

-- 
Alexander Limi · http://limi.net


_______________________________________________
Plone-developers mailing list
Plone-developers at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-developers


----- End forwarded message -----

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-Dev mailing list