Loading of thumbnails in gallery view slow

Hi guys,

I am using Nextcloud for quite now and am very happy with it. One of the things that bother me though is the performance of the gallery view. Loading of thumbnails is very slow. I already use the previewgenerator app to generate all my previews. At the moment there are around 6000 image files and a total of 17GB under the appdata_.../preview folder.

Nextcloud 13.0.1 runs with Docker-Compose on a VPS with 8 Cores and 8GB RAM. It has 4 more or less active users and load under normal working conditions is between 0.5 and 3.

Each GET request for thumbnails (e.g. GET apps/gallery/thumbnails?ids=12028;12075;12135;12064;12125;12077&scale=1&square=0&requesttoken=...) takes between 7 and 10 seconds (browser cache disabled). Is this considered normal?

During those requests top shows a php-fpm process with around 50% and the redis-server with around 25%. IO-wait and steal are below 1%.

I already tried to understands what’s taking that long and generated a profile of the thumbnail request with XDebug. As you can see there almost all time is spent in OC\Files\AppData->getAppDataFolder while fetching the first thumbnail. It seems that all files in the whole preview directory are fetched from the file cache there.

I wonder if this is normal or if I made a mistake in configuration somewhere. Maybe someone of you has another idea or experienced similar problems.

@rullzer and @MorrisJobke do you have any thoughts?

Thanks in advance!

1 Like

I guess the gallery app does not yet use the servers previews but uses their own. We should migrate this app over to the native previews. @oparoz @rullzer please confirm

They are. The main issue is that they are all processed in server memory since they are served via the one stream (the name escapes me right now).

So the previews are shared. But the way they are served is suboptimal and breaks browser caching.

Thank you very much for your answers!
Are there any plans for optimizing preview handling?