-
Notifications
You must be signed in to change notification settings - Fork 11
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
High RAM/CPU usage when generating large amounts of previews #31
Comments
What platform are you on? Nextcloud or owncloud? At least in nextcloud there is a certified amount of images that's retrieved in the same time. That limit is certainly not as high as 400. More like 8. This is probably also too high. It's not feasible to do this in this app I am afraid, because this is only a preview provider for *cloud. It would be the other apps like Files that handles retrieving of previews. |
Come to think of it, it may also be a database issue. Maybe a non-optimized query to the the filescache. Are you able to put on a slow query log on you platform? |
I'm running Nextcloud 15.0.6. From what I was seeing it was spinning up well over 8 threads for rendering the images. Unfortunately I have the slow query log turned off, but from what I could tell it wasn't the database that was causing either problem. Most of the CPU time and RAM usage was coming from elsewhere. As for the preview generator, I have encryption turned on, so it will only generate thumbnails the first time you open the folder. While it may be that the Files app should ensure that it's not hammering the server with too many requests, I would still urge you to build in some sort of mechanism to enforce that only a certain number of renders can happen at a time just in case a calling application is misbehaving. |
@Eeems I hear you. Let me check if this is doable without redoing the whole app. I bet this mostly comes from big files and the process of decrypting them + many threads. For small jpegs there isn't much decrypting needed, but for bigger files like CR2 there is. It makes sense. Probably when files are encrypted the amount of previews requests by the Files app, should be limiting not only to a certain amount of images per request, but also limited to a maximum size. |
@Eeems Another observation here is that the Files app in thumbnail mode shows way more images than if using the Gallery app in the same folder. Does it help for you in the Gallery app? |
@Eeems Thank you for your screenshots. Fixing this in a simple clean way is just not possible due to several things. I need to conform to how a nextcloud app should behave. It's PHP so it's inherently request based. Fixing it here will only help for raw files, and would be a very hacky fix. Let's see if we could fix in this in Files instead. |
Thanks for the help @cowai |
[moved comment to new issue] |
When opening a folder with lots of RAW images for the first time and scrolling to the bottom, I noticed that my server's fans went into overdrive. Upon further inspection it was because this addon was attempting to run every single preview generation at the same time (~400 images). This was maxing out the CPU and using over 20GB of RAM (All available and a good chunk of swap).
I would highly recommend adding some sort of configurable pooling/locking mechanism to limit how many processes can run at once to avoid having servers fall over.
The text was updated successfully, but these errors were encountered: