Gallery image browsing (click on an image) very slow for large folders

I have an issue with the Gallery of my Nextcloud 20.0.4. When I browse my Photo Gallery and click on an image, it takes Nextcloud 5 to 8 seconds to display the image. I don’t think that is has something to-do with thumbnail generation, because it takes the same time no matter how often I open up the same image again.

I also noticed, that the image loads fast if I move it into a directory with only 2 files in it. So my wild guess is, that the preview queries a directory index or so?

This is noting special with Nextcloud 20, I have this issue for many years now…
I created a video which shows the issue: https://youtu.be/xfGll8y12oQ

I noticed this two requests which are very slow:

XHRPROPFIND https://cloud.nook24.eu/public.php/webdav/
[HTTP/1.1 207 Multi-Status 8589ms]
XHRPROPFIND https://cloud.nook24.eu/remote.php/dav/files/nook24/Photos/
[HTTP/1.1 207 Multi-Status 2818ms]

This one respond an at least 33k lines XML file (rest get’s truncated by Firefox) with images from 2018.
So yes, I think Nextcloud sends informaation about ALL images to the Browser and creating this massiv XML (on the server) and parse it on the client is is probably the root cause of the whole situation.

My Nextcloud Setup:

  • Ubuntu 18.04
  • PHP 7.2.24-0ubuntu0.18.04.7
  • MySQL 5.7
  • SAS HDDs – it’s not an IO issue