collective / collective.nitf

A Dexterity-based content type inspired on the News Industry Text Format specification
8 stars 3 forks source link

Avoid performance issues when having many users #129

Closed hvelarde closed 9 years ago

hvelarde commented 9 years ago

closes #128

idgserpro commented 9 years ago

This pull seems ok. I tested in a vanilla Plone running all tests again and with some manual testing. We will just try to do some stress tests to make sure it's the optimization we were looking for this specific problem.

hvelarde commented 9 years ago

please merge the pull request when you successfully finish your tests; also, feel free to change the memoizer in case you need one a little bit more aggressive.

I guess caching for a small amount of time like one minute, could be enough; you can use something like this:

from plone.memoize import ram

@ram.cache(lambda method, self, fullname: (time() // 60, fullname))
def _search_member_by_name(self, fullname):
   ...
idgserpro commented 9 years ago

This more agressive piece of code is safer in a LDAP context IMHO. If you wouldn't mind changing it, I will merge the pull request.

idgserpro commented 9 years ago

@hvelarde We can delete this branch after merging, right?