Nextcloud slow web frontend

Nextcloud version : 21.0.1
Operating system and version: Ubuntu 18.04
Apache or nginx version : nginx 1.18.0.2-v.ubuntu.18.04+p18.0.33.0+t210104.1822
PHP version : 8.0

The issue you are facing:
The web interface of my NextCloud instance in incredible slow.

When I navigate between apps (eg from dashboard to files) the page sometimes loads longer than 10 seconds.
My server should have enough power (6 cpus, 12 gb ram, 500 mbit/s, ssd). The average cpu load is always below 1.3 and there is plenty of free ram.
I did a test with lighthouse on the files page and the result was devastating.

I tried a lot of the actions suggest at Server tuning — Nextcloud latest Administration Manual latest documentation (like using MariaDB; enable caching, switching from apache to nginx and enable http2, tuning php-fpm), but they didn’t improve the speed of the application.
I also disabled talk for files.

I think the main problem is, that there are to many files downloaded (above 20 MB) and to much javascript running. One of the users complained, that his computer is nearly dying when he browses on the web frontend, because the page is so big.

Am I missing some switch to production mode or compress files setting somewhere? Or is there another reason, why the application is that slow?

The output of your Nextcloud log in Admin > Logging:

The logging is spamming for a lot of apps (i have all on the newest stable version): 

[files_sharing] Debug: /appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.

And there are also some 

Deprecated event type for OCA\Files::loadAdditionalScripts: Symfony\Component\EventDispatcher\GenericEvent is used

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

<?php
$CONFIG = array (
  'passwordsalt' => '**************',
  'secret' => '*****************',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '**************',
  ),
  'datadirectory' => '/var/www/vhosts/************/.nextcloud/data/5e667ecf4605',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud_*********',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*************',
  'dbpassword' => '*********',
  'installed' => true,
  'instanceid' => 'oc8832d20jsy',
  'mail_from_address' => 'system',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '********',
  'mail_smtphost' => '***************',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => '***************',
  'mail_smtppassword' => '****************',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'mysql.utf8mb4' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'updater.release.channel' => 'beta',
  'default_phone_region' => 'DE',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'password' => '*************',
    'timeout' => 1.5,
    'dbindex' => 0,
  ),
  'updater.secret' => '*************',
);

The output of your Apache/nginx/system log in /var/log/____:

error.log:

[ N 2021-04-18 14:22:20.5586 21146/T9 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ N 2021-04-18 14:22:20.5587 21146/T1 age/Cor/CoreMain.cpp:1246 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ N 2021-04-18 14:22:20.5588 21146/Tb Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5588 21146/T9 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5588 21146/Tb Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
[ N 2021-04-18 14:22:20.5588 21146/T9 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
[ N 2021-04-18 14:22:20.5588 21146/Td Ser/Server.h:902 ]: [ServerThr.3] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5588 21146/Td Ser/Server.h:558 ]: [ServerThr.3] Shutdown finished
[ N 2021-04-18 14:22:20.5589 21146/Tf Ser/Server.h:902 ]: [ServerThr.4] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5589 21146/Tf Ser/Server.h:558 ]: [ServerThr.4] Shutdown finished
[ N 2021-04-18 14:22:20.5589 21146/Th Ser/Server.h:902 ]: [ServerThr.5] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5589 21146/Th Ser/Server.h:558 ]: [ServerThr.5] Shutdown finished
[ N 2021-04-18 14:22:20.5591 21146/Tj Ser/Server.h:902 ]: [ServerThr.6] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5591 21146/Tj Ser/Server.h:558 ]: [ServerThr.6] Shutdown finished
[ N 2021-04-18 14:22:20.5591 21146/Tl Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
[ N 2021-04-18 14:22:20.5592 21146/Tl Ser/Server.h:558 ]: [ApiServer] Shutdown finished
[ N 2021-04-18 14:22:20.6182 21291/T1 age/Wat/WatchdogMain.cpp:1373 ]: Starting Passenger watchdog...
[ N 2021-04-18 14:22:20.6729 21294/T1 age/Cor/CoreMain.cpp:1340 ]: Starting Passenger core...
[ N 2021-04-18 14:22:20.6730 21294/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2021-04-18 14:22:20.6860 21294/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 21294
[ N 2021-04-18 14:22:20.8310 21146/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
[ N 2021-04-18 14:22:20.9804 21146/T1 age/Cor/CoreMain.cpp:1325 ]: Passenger core shutdown finished
[ N 2021-04-18 14:22:22.8299 21294/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)

The browser console is full of deprecation warnings like

capabilities.js:32 OC.getCapabilities is deprecated and will be removed in Nextcloud 21. See @nextcloud/capabilities
getCapabilities @ capabilities.js:32
2globals.js:60 $ is deprecated: The global jQuery is deprecated. It will be updated to v3.x in Nextcloud 21. In later versions of Nextcloud it might be removed completely. Please ship your own.

And there are also this errors:

The only installation warning i have, is that php-imagick is missing. But this module doesn’t exist for php8.0. Switching to php7.4 removes this warning, but the application is still slow.

1 Like

In theory, the large files take long to load for the first time, for later calls they should be mostly cached and much faster. However, more than 10s seems a bit slow. With top and iotop, you can check the processes, if you have a lot of io-wait and the database is blocking it, you can certainly improve the database cache settings.

Another point can be apps that are always loaded in the background. Try to disable less important to see if it makes a difference.