[Zope-dev] Re: ZCatalog fast as admin, dog slow as anonymous
and other users
Jason Spisak
me at jasonspisak.com
Fri Jan 30 14:18:13 EST 2004
Tres,
You are right. I've also got that permission turned off to take
advantage of that part of the CMF workflow, which compounds the problem
since it's site wide. I'm building the individual DateIndexs now and
when that's done, I'll check the performance (for my own edification if
nothing else 8-). Then I'll add that DateRange index and patch the CMF
and check again.
Do you guys want metrics? If so, preferred tool/output method?
(although my guess is, you already know how spiffy this makes things 8-)
Tres Seaver wrote:
> Jason Spisak wrote:
>
>> Zopistas,
>>
>> My ZCatalog is fast as admin, but dog slow as anonymous and other
>> users. Anyone had this same experience? Details:
>>
>> marjors:
>>
>> Zope 2.6.2
>> CMF 1.3
>> Plone 1.0.5
>>
>> about 50,000 cataloged objects (dual xenon server, plenty of ram, RAID)
>>
>> User folder has 15k users in it, but admin is one of those users.
>>
>> i've factored it way down and a simple search with just 1 Event
>> loaded, like:
>>
>> return context.portal_catalog(Type='Event')
>>
>> is instantaneous for the 'admin' user, but takes about 10 seconds to
>> return 1 SINGLE object. (only 1 Event loaded) imagine the time it
>> takes to search and display 1300 events (which is what's normally in
>> there). ouch. i've rebuilt the indexes, and still no dice.
>>
>> Any help would be greatly appreciated.
>
>
> This symptom probably has to do with the login in the CMF catalog which
> filters results based on the effective - expiration dates, for anybody
> without the "View inactive content" permission. I would guess that your
> portal_catalog is *not* using a DateRangeIndex to filter such content,
> but is still using the individual 'effective' and 'expires' indexes.
>
> To fix this:
>
> - Add a DateRangeIndex, 'effectiveRange', to your portal_catalog;
> set its start attribute to 'effective' and its stop attribute to
> 'expires'.
>
> - Patch CMFCore/CatalogTool.py using the attached patch file (made
> against the released 1.3 version).
>
> Tres.
>
>
> ------------------------------------------------------------------------
>
> Index: CMFCore/CatalogTool.py
> ===================================================================
> RCS file: /cvs-repository/CMF/CMFCore/CatalogTool.py,v
> retrieving revision 1.30.4.6
> diff -c -r1.30.4.6 CatalogTool.py
> *** CMFCore/CatalogTool.py 1 Aug 2002 19:07:55 -0000 1.30.4.6
> --- CMFCore/CatalogTool.py 30 Jan 2004 18:16:37 -0000
> ***************
> *** 12,18 ****
> ##############################################################################
> """ Basic portal catalog.
>
> ! $Id$
> """
>
> import os
> --- 12,18 ----
> ##############################################################################
> """ Basic portal catalog.
>
> ! $Id: CatalogTool.py,v 1.30.4.6 2002/08/01 19:07:55 tseaver Exp $
> """
>
> import os
> ***************
> *** 202,215 ****
> if not _checkPermission(
> CMFCorePermissions.AccessInactivePortalContent, self ):
> base = aq_base( self )
> ! now = DateTime()
> ! if hasattr( base, 'addIndex' ): # Zope 2.4 and above
> ! kw[ 'effective' ] = { 'query' : now, 'range' : 'max' }
> ! kw[ 'expires' ] = { 'query' : now, 'range' : 'min' }
> ! else: # Zope 2.3
> ! kw[ 'effective' ] = kw[ 'expires' ] = now
> ! kw[ 'effective_usage'] = 'range:max'
> ! kw[ 'expires_usage' ] = 'range:min'
>
> return apply(ZCatalog.searchResults, (self, REQUEST), kw)
>
> --- 202,208 ----
> if not _checkPermission(
> CMFCorePermissions.AccessInactivePortalContent, self ):
> base = aq_base( self )
> ! kw[ 'effectiveRange' ] = DateTime()
>
> return apply(ZCatalog.searchResults, (self, REQUEST), kw)
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
More information about the Zope-Dev
mailing list