Questions about Nextcloud performance

Nextcloud version (eg, 12.0.2): 16.0.5
Operating system and version (eg, Ubuntu 17.04): Debian GNU/Linux 10 (buster)
Apache or nginx version (eg, Apache 2.4.25): 2.4.38
PHP version (eg, 7.1): 7.3.9

Run through NextcloudPi within Docker on a Raspi 4B - 4GB with extensive cooling and a great power supply.

The issue you are facing:
Everything is so slow.
Everything is so slow since minute 1. I spent the past week tweaking my installation to my needs and now I have come to optimize the installation, just to find out it already was optimized by default. I tried searching different methods of optimization, but all I found was already applied.

At first, I had the entire installation on my Transcend 300S SD card (very high quality) and it was slow. Now I moved the Nextcloud data directory to an HDD. Still slow. No matter what I added/removed/changed with Nextcloud, everything is super slow.

I think the fastest load time I encountered was 10 seconds. Everything else is above that. Sometimes way above that. A couple of times it even took about ~60 seconds to load the Nextcloud page.

I am generally very patient and deal with longer load times with ease but Nextcloud just takes a super long time, that sometimes is unbearable, especially if you quickly just want to drop in something you need.

I have read some older articles on how to optimize Nextcloud. Some suggestions weren’t compatible with my installation, others were already applied. I did not find an up-to-date article, though.

As I use a Raspberry Pi 4B with 4GB RAM available, I have plenty of power to use, I just don’t know how I let Nextcloud use it better.

As this is a new instance, there are so far only 2 users of it.

What can I do to make things faster?
What hardware component has the biggest impact on performance? (Storage, RAM, CPU, etc.)


Q: What feature of Nextcloud causes long load times?
A: Any feature.

Q: What about the hardware XY part?
A: The hardware is perfectly fine and is rigorously tested to work as expected.

Q: Did you install a lot of apps?
A: Apps or a bigger installation don’t have anything to do with that, as it has always been slow since the beginning.

Q: Did you play around with the config or with the database?
A: It is slow since minute 1, before I did anything with the instance after installation.

Is this the first time you’ve seen this error? (Y/N):
No. I installed Nextcloud about 1 year ago already and it was super slow as well. On entirely different hardware, in an entirely different location.

The output of your Nextcloud log in Admin > Logging:

Logs are bloated with stuff that happened when I tried optimizing the instance. Nothing else of intereset to see.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  'datadirectory' => '/data/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'url.tld',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  'tempdirectory' => '/var/www/nextcloud/data/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => '',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'loglevel' => 2,


What you describe seem to be loading times of the web pages. Therefore the install medium should not be the (relevant) bottleneck.
Nextcloud is a web application which stores file information (list of files belonging to a user) in the database. Consequently the most relevant components regarding the performance are:

  • the web server (and therefore mostly RAM)
  • php interpreter (mostly CPU)
  • database (and the storage the database files are stored on)

When the Nextcloud page loads quickly but just details (like the file list, deck cards and so on) load very slowly, then the database and probably the storage is the bottleneck.

If every web page is loading very slow, then the web server and PHP interpreter may be the bottleneck.
For both componenents to work well, the things to check are maybe:

  • is php interpreter using enough RAM to store most of the PHP files in RAM already for quicker serving?
  • is the web server configured and allowed to load enough child processes or even too much?
  • is the web server consuming too much CPU load?
  • are web server and php interpreter configured to be limited to one CPU core only?

To analyze the issue and find the root cause I would watch htop / top and monitor the overall performance of the server regarding CPU, RAM and swapping during Nextcloud access. Check where the load is.With the real bottleneck identified, we could search for possibilities to improve the performance.
In addition check the system logs (journalctl) and the web server logs for any error messages. Every error could slow things down. Try to solve the errors if there are any and check if the performance improved.


What a great and thorough explanation. I will check the server in the ways you described and update this post, if I find something. Thank you very much for this well made explanation.

I have a similar setup: NextcloudPi on an RPI4 with 4GB and a 1TB SSD on USB3, 100Mbit Ethernet. I don’t use Docker AFAIK.

Web pages load in about 1s, which seems quite reasonable. The only thing that is very slow is logging out!

Hi @nop_head

Which browser are you using? If Chrome, could you check if the slow logout happens with Firefox as well?
In addition: which NC version are you using?

There is a know issue:

So there seems to be an issue with Chrome regarding the “Clear-Site-Data” header, which is sent out with the Logout. One data type for that header has been removed with NC16.0.5 and with NC17, so both versions should fix that issue. … If that is actually your issue.

1 Like

I am using Chrome and NC16.0.4.1. It is much faster with Firefox so it will be that issue. Not a big problem as I have no reason to log out when at home.

1 Like

Thanks for the input. I will keep your results in mind.

It is kind of funny that slow log outs are apparently a known issue, because I wouldn’t even have noticed this. Of all the things Nextcloud has to offer, logouts are literally the very last on the list, when it comes to speed being an issue. For what I use Nextcloud for, you might as well remove the logout button altogether, as I never use it anyway. :joy:

1 Like

I use NC17 with Brave browser and it’s extremely slow at logging out, which I do occasionally when switching between my main account and the admin. It can take nearly 30 seconds most times, and when I check the load on the server it’s not that. As said above everything else about NC loads very fast, and it was never the case with my old ownCloud setup.