-
Notifications
You must be signed in to change notification settings - Fork 333
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
/treeview endpoint is slow when a lot of nodes are in the tree #2250
Comments
I'm also finding issues with SiteTree performance, however i think the issues is largely deeper than just rendering. I've got a SiteTree with ~6400 records, most of which is under a single node. Looking deeper, it feels like an issue with how Do you think that it is related to this, or seperate? I actually was playing with these settings (in your PR) already, which allows at least the rendering of the tree in the modal. |
Related: silverstripe/silverstripe-admin#571 |
The |
So the tree drop down issue seems to be the fact it's calling It makes more sense to me to do the filter on the initial query, because we're operating on less data being a subset that way. The only other thing, is it calls the same function Do you know if |
Hmm i think i see why now, the other option is applying the hierarchy limits on the search results first too, the likely scenario is the source data should be bound by the same limits as the SiteTree. Either way this looks like way too much work for these situations. |
We're at a point now where the The top level of our Site Tree contains 25 records, and then there are some pages that contain as many as 125 children. Setting
The client snapshot is the best DB to use to test this. |
@unclecheese Is the TreeDropdownField issue sufficiently different to split out into it's own Github issue? I think this form field shouldn't use the tree logic at all. It displays a list, and could optionally cache one level further inwards. None of these requires the weird |
The way the sitetree view is built right now is perhaps a bit overkill. Basically, we start from the root node and try to figure out which nodes needs to be expanded to reach our targeted page. If I was writing this thing from scratch, my instinct would be do it the other way around ... start from my targeted page and work my way up. Maybe there's some deeper reason for doing it the current way that is eluding me. I'm thinking a way around our current predicament could be to implement some sort of TreeRenderingService that could be injected into CMSMain. That could allows sites to use custom logic to render their sitetree. That would allow us to implement my bottom-up logic to render the treeview (for the record I'm not actually 100% sure it would be faster). Currently, the worst case scenario for me is ~2.7 sec to render treeview. That's when access the treeview . On a side note, |
@unclecheese @blueo @chrispenny How does this compare to your findings? Aaron indicated 12-18 secs in the initial issue description here. Note that this is rendering the tree. We've split out the TreeDropdownField discussion into a separate issue (#2265). 2.7 secs seems acceptable, 18 secs isn't. It seems unlikely that this big difference is due to environments (Vagrant vs. SSP)?
Yeah, since we no longer present hierarchical search results in the tree or TreeDropdownField views, it's a lot more viable. Which is probably the reason it was implemented top-down rather than bottom-up. When we refactor the tree to React, I want to get rid of all the marking logic, and do more on the client. A TreeRenderingService would be a way for advanced users to fix this (and accept functional tradeoffs) but in the end there are other complex websites which have a similar issue. So I'd call that Plan B. First of all, are we sure that there's only the max of ~250 nodes being processed here? I'm still a bit incredulous that doing anything with 250 things in SilverStripe could take 18 secs. If that's the case, then let's dig through any specific performance bottlenecks within those 250 things, for example is fluent adding overhead?
The combination of user/context specific |
@chillu @unclecheese @chrispenny The speed of treeview highly depends on the structure of the tree. In the DB we're using (unclecheese has a copy) the top level pages only take 2 - 4s to pull down sitetree but page id 7772 further down the tree, takes around 12s. The difference appears to be number of child pages (ie more = slower load). NB the tree call from Treedropdown is pretty similar to this when targeting sitetree. |
I think that Versioned::canView can be optimised by calling Also |
Argh, scratch that, I wasn't looking at a complete project when I concluded that prepopulate_versionnumber_cache wasn't being called :-/ |
@maxime-rainville @unclecheese I think another thing that would help here: precaching of Approach:
Hard things:
Should I break this out as a separate ticket? |
I can't see any use of augmentStageChildren in the supported modules, which suggests that it is rare. As such I'd probably:
|
I've put this over here: silverstripe/silverstripe-framework#8379 |
Have raised this issue too which will help https://github.com/tractorcow/silverstripe-fluent/issues/467 |
Treeview response time has been increased substantially. I think we've address most of what we can without a major refactor of the treeview rendering logic. I'll close this for now and reopen it if our key project requires further work. |
Per silverstripe/silverstripe-admin#571
Request admin/pages/edit/treeview
CMSMain::treeview() takes 12 to 18 seconds to generate response. This function just populates a template:
$this->renderWith($this->getTemplatesWithSuffix('_TreeView'))
Further investigation is needed to figure out which part of the template is slow. This issue is present on every CMS page which shows the site tree, but at least is triggered only once.
Summary:
Issue occurs once per every CMS page load.
Pull Requests
The text was updated successfully, but these errors were encountered: