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

Performance improvement for the "Upcoming Events" portlet #351

Open
frapell opened this issue Mar 25, 2022 · 0 comments
Open

Performance improvement for the "Upcoming Events" portlet #351

frapell opened this issue Mar 25, 2022 · 0 comments

Comments

@frapell
Copy link
Member

frapell commented Mar 25, 2022

We have a site which currently has +1500 events, and the customer has put 2 Upcoming Events portlets in its homepage.
End result, loading time takes about 12 seconds.

In trying to figure out what was happening, I used py-spy which showed get_events and in particular filter_and_resort appear to be quite CPU intensive. And with more and more events being added almost daily, it is only going to get worse.

I don't know if these methods can be made to perform much faster, however In order to try and mitigate the performance hit, I am patching the portlet events method and using the @ram.cache decorator from plone.memoize to cache the results, using a key based on a way cheaper portal_catalog call that will be different if the events that are likely to be shown in the portlet are modified, thus making it void and having the events to be recomputed. This improvements makes the homepage to now take 1 second to load.

I am submitting this fix in a PR, in case this sounds useful to be included with the portlet.

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

1 participant