Revolution: Media Browser getting slow

Created on 10 Oct 2017  路  7Comments  路  Source: modxcms/revolution

Summary

Media Browser is getting slow when you have a lot of files and directories.

Step to reproduce

Add a lot of files and directories on your filesystem.

Environment

Tried multiple environments but not a noticeable difference.

Does someone have a quick fix for this or some optimization tips?

Most helpful comment

Having direct access to the thumbnail images without using a connector would be the solution. The list files connector should do the thumbnails.

Another option: Maybe a deferred loading of viewport only thumbnails could avoid booting up modx (inside the connector) 400 times in such folders.

All 7 comments

@pixelive Could you please be more specific so it is easier for others to recreate? How many files and directories do you have? What does slow mean? What browser do you use? Do you see any difference when using other browsers?

@OptimusCrime

I think the problem is getting caused once retrieving the files, some folders have around ~400 files mostly images. The directories do not have that much impact I think (on the speed).

It sometimes takes around 10 seconds to see the first results within the media browser.

We tried multiple browser, upgrading the server (which is pretty strong at the moment). The only thing which is untested at the moment is using PHP7.

It probably has to do with the connector call or thumbnails, but I was wondering if somebody had some quick fix for it (or runs into the same problem).

Thank you for more information. I suspected it was concerning images. I believe this is the culprit as well. I am not 100% sure, but I think the thumbnailing is happening for all images in the directory for each file in the directory. As far as I know, there is no easy way to get around this. One fix would be to be sure never to have that many files in a single directory. This is something you should do either way, as many files in a single directory may cause slow responses for various reasons.

Having direct access to the thumbnail images without using a connector would be the solution. The list files connector should do the thumbnails.

Another option: Maybe a deferred loading of viewport only thumbnails could avoid booting up modx (inside the connector) 400 times in such folders.

See the $imageQuery generation visible in #13704 for modifying the thumbnail generation. The thumbs could be done with runSnippet pThumb + options or more general by a system event that calls pThumb or different installed thumbnailer or a direct phpThumb call + a caching solution.

Thumbnail generation is definitely the problem here. Switch to list view and all is well. My server load goes sky high whenever viewing a directory with even a modest number of images in it. PLUS, the thumbnails don't actually seem to be cached on the server anywhere; they seem to be pushed to the browser and cached there. When I use one browser and wait for all the thumbnails to get generated, then switch to a different browser, then thumbnails get regenerated all over again. Is this actually what's going on here? Thumbnails should be cached on the server.

PR #13805 should solve this issue and with it being merged I'm therefore closing this issue.

@modxbot close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ruslan-Aleev picture Ruslan-Aleev  路  3Comments

travisbotello picture travisbotello  路  3Comments

travisbotello picture travisbotello  路  3Comments

lemon666 picture lemon666  路  4Comments

sottwell picture sottwell  路  3Comments