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

Reduce load time when loading the edit section for sites with large hierarchy #63

Closed
nikolas opened this issue Mar 14, 2015 · 4 comments

Comments

@nikolas
Copy link
Member

nikolas commented Mar 14, 2015

When running worth2 locally, the "view section" view loads in 500ms, while the "edit section" view loads in 2800ms. django-debug-toolbar reports the SQL queries only took 100ms. @sdreher says this due to the checks for locking / gating. It would be good to find a way to reduce the load time here.

@nikolas
Copy link
Member Author

nikolas commented Mar 19, 2015

In addition to optimizing the checks for locking/gating (which I haven't looked into yet), integrating jquery-pjax in the pagetree admin view would definitely help here. With jquery-pjax, we could avoid having to render all 7 tabs at once, which shouldn't be necessary anyways.

@nikolas
Copy link
Member Author

nikolas commented Apr 24, 2015

One performance issue is in displaying the hierarchy of pages (this loop in the template https://github.com/ccnmtl/django-pagetree/blob/master/pagetree/templates/pagetree/edit_page.html#L121)

Removing the is_last_child call reduces query and load time by about half. But we need this call in order to render the lists correctly. This function is being cached (https://github.com/ccnmtl/django-pagetree/blob/master/pagetree/models.py#L217) -- we could make sure the cache is behaving correctly.

The performance issue is bad on local development (i.e. my page load is 10 seconds on the WORTH2 pagetree edit view) but less noticeable on production, fortunately.

@thraxil
Copy link
Contributor

thraxil commented Apr 24, 2015

Have you enabled Django's cache in your settings? I don't see a 'CACHES' line anywhere in the worth2 settings.

nikolas added a commit that referenced this issue May 2, 2015
When debugging the `is_last_child` cache, I saw the value
of cache.get() here is either 1, 0, or None if the cached
value isn't present. Currently, only values of 1 are getting
used, because if the value is 0, the `if v:` to check if
the cache is present fails. I think we need to be more
specific here and do: `if v is not None:`

This change improved performance a little bit in my local testing,
but it's still not great: Calling the cache for each node in the
tree takes time, and it would be great to find a way to interact
with the cache just once for the pagetree edit page.

refs #63
nikolas added a commit that referenced this issue May 2, 2015
When debugging the `is_last_child` cache, I saw the value
of cache.get() here is either 1, 0, or None if the cached
value isn't present. Currently, only values of 1 are getting
used, because if the value is 0, the `if v:` to check if
the cache is present fails. I think we need to be more
specific here and do: `if v is not None:`

This change improved performance a little bit in my local testing
with memcached, but it's still not great: Calling the cache for
each node in the tree takes time, and it would be great to find
a way to interact with the cache just once for the pagetree edit
page.

refs #63
@nikolas
Copy link
Member Author

nikolas commented Aug 14, 2015

closing this ticket because the load time for the pagetree admin section is now fine on worth2, after setting up caching.

@nikolas nikolas closed this as completed Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants