Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegistryReader has bad performance on sites with a lot of users #66

Open
datakurre opened this issue Aug 22, 2016 · 3 comments
Open

RegistryReader has bad performance on sites with a lot of users #66

datakurre opened this issue Aug 22, 2016 · 3 comments

Comments

@datakurre
Copy link
Member

Collections call view @@qsOptions for the query field options. That view is defined in plone.app.content, but it delegates all work to QuerystringRegistryReader in plone.app.querystring. Registry reader "simply" dumps configuration for all queryable fields and operations (both enabled and disabled), including all distinct values for related vocabularies. For sites with a lot of editors, vocabulary for Creator field may become large (and all values are twice in the resulting JSON, once for all indexes and once for sortable indexes). Yet, if the sites is using LDAP (tested only with LDAPUserFolder), rendering @@qsOptions requires fetching full name for all users, who have created content in the site. With some bad luck with the current LDAPUserFolder caches, this may choke a single instance site for a while.

I don't see any obvious fix for this. Comments and ideas are welcome.

@datakurre
Copy link
Member Author

datakurre commented Aug 24, 2016

A quick local fix for this is

  1. Update the second default value of registry field plone.app.querystring.field.Creator.operations to plone.app.querystring.operation.string.is instead ofplone.app.querystring.operation.selection.any (can be done TTW)
  2. Delete registry record plone.app.querystring.field.Creator.vocabulary (cannot be done TTW)

This replaces the nice selection widget for Creator criterion with a dummy string field.

@datakurre
Copy link
Member Author

And this is minimal registry.xml

   <records interface="plone.app.querystring.interfaces.IQueryField"
           prefix="plone.app.querystring.field.Creator">
    <value key="operations">
      <element>plone.app.querystring.operation.string.currentUser</element>
      <element>plone.app.querystring.operation.string.is</element>
    </value>
    <value key="vocabulary" remove="true" />
  </records>

@tomgross
Copy link
Member

tomgross commented Jan 4, 2017

I have the same issue for a site with some big taxonomies. I use this for the qsOptions view:

ONE_DAY = 60 * 60 * 24


class PatchedQueryStringIndexOptions(BrowserView):

    @ram.cache(lambda *args: time() // ONE_DAY)
    def get_config(self):
        registry = getUtility(IRegistry)
        config = IQuerystringRegistryReader(registry)()
        return json.dumps(config)

    def __call__(self):
        self.request.response.setHeader(
            'Content-Type', 'application/json; charset=utf-8'
        )
        return self.get_config()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants