Help Nextcloud Painfully Slow

Can anyone provide assistance or any ideas on how to speed up nextcloud. I have about 4tb of data that consists of about 2.5 million files. It is an ubuntu server on enterprise hardware running the nextcloud docker. I have the storage connected through network SMB. It is painfully slow, like 3 to 5 mins to navigate through the web interface. I have the desktop app and any changes to that tend to take 30 mins to replicate on the server.

I don’t know why it is so slow and have run out of ideas to speed it up. Any recommendations on how to possibly make this faster?

Nextcloud version 26.0.5
Ubuntu 22.04
Apache 2.4.52
php 8.1.23

The issue you are facing:

Brutally slow navigation

Is this the first time you’ve seen this error? (Y/N):


Steps to replicate it:

  1. Open nextcloud

The output of your Nextcloud log in Admin > Logging:

[webdav] Error: Sabre\DAV\Exception\ServiceUnavailable: Could not open file at <>

  1. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 85
  2. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
  3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
  4. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
  5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
  6. /var/www/nextcloud/apps/dav/lib/Server.php line 360
  7. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
  8. /var/www/nextcloud/remote.php line 172
    require_once(“/var/www/nextcl … p”)

2.5 million files

I have the storage connected through network SMB.

SMB isn’t the fastest method of remote storage unfortunately. Are all these files in one DIR? if so you’re going to struggle with any file listing that check for changes on every access.

The error you’ve posted is possibly time-out related? So it could be cause by the SMB side of things. I’ve found mounting the SMB share on the server and then using the Local folder as an external share tends to work better.

  • Where on the network is your SMB share? Local, remove, VPN?
  • Could it be DNS or netowrking issues? I had an instance where every request was routing out an overloaded firewall and hair-pining back through the firewall causing significant latency.
  • What about permissions/authentication error? check your SMB host to see if there are any intermittent issues.
  • Is the SMB host overloaded?
  • Can you use a more performant remote file systems mounting method such as NFS or iSCSI?

That said typically I’ve found the Database to be the greatest limiting factor. So the usual performance questions are:

  • Are you using Redis?
  • Have you setup caching?
  • What DB are you using? e.g. Don’t use Sqlite
  • What media is your DB on? e.g. SSD ideally NVME
  • How is your PHP settings? (check the docker std out logs) are there enough servers? is it complaining about low memory?