-
Notifications
You must be signed in to change notification settings - Fork 80
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 to assets/api/readFolder #337
Conversation
Only get the full details about a file after we have decided to return it.
@tractorcow That's what happens when I use the github online editor to create my PR :-) |
Thank you Mike! As @tractorcow suggested, this has been fixed in the GraphQL work - I've disabled sorting by the Feel free to check out the GraphQL branches: For the moment, I don't think its worth introducing partial "sort object data" complexities in the implementation, if the GraphQL fixes it by better pagination. Pull request incoming this week, see #316. I haven't tested it with large amounts of files yet, but in theory it should scale to 10k files per folder (which is our NFR for the feature). Would you able to check out the branches and see if it helps your cause? |
Damian just pointed out that this optimisation might be about calculating file sizes, rather than pagination. It's probably less impactful to calc file size on 15 paginated items than to load 900 items through the ORM? Anyway, GraphQL will only call |
For me the performance hit is on canArchive()/canDelete() call which has some logic in it for me (can't delete/archive if there's a published page using the file + some more permissions stuff). I'll have a play with the GraphQL branches and see how it goes. |
We've had a chat and decided to let this PR site for a while, as we are finalising the graphql work. Sorry if this blocks your work in any way! |
I wouldn't have imagined My first thought was the |
Oops. :D |
@mikenz I'm closing this in favour of silverstripe/silverstripe-framework#6458. Have tried it out with 1000 files in a folder (generated with silverstripe/silverstripe-frameworktest#26), and 128M The logic is quite different now (with GraphQL), so this PR isn't really mergeable any more. The optimisations it implements (only get full details of file after returning) aren't fully reflected in the work. Given it does the pagination before querying all records (as part of converting to a Would you be able to switch to the PR branches mentioned above and check if that solves the problem for you? |
The new GraphQL based implementation performs well for me. Thanks :-) |
I have a few folders with 900+ images in them. This was the change I made to get reasonable performance in asset-admin.
Only get the full details about a file after we have decided to return it.