[Zope-dev] Re: ZCatalog fast as admin,
dog slow as anonymous and other users
Tres Seaver
tseaver at zope.com
Fri Jan 30 13:17:35 EST 2004
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.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
-------------- next part --------------
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)
More information about the Zope-Dev
mailing list