Nextcloud frontend/web-interface very slow despite caching

Nextcloud version (eg, 20.0.5): 23.0.0
Operating system and version (eg, Ubuntu 20.04): 20.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 7.4): 8.0

The issue you are facing:

So I’ve been running Nextcloud for a few days now and I’ve noticed that the web-interface is extremely slow to load, it can sometimes easily take 5-10 seconds to load and then switching apps or pages similarly long whereas other services I run on that server that use large databases (Gitea) load much quicker especially with Apache caching enabled.

I have php-fpm, apcu, redis locking and opcache all enabled and this issue still persists.

I have also verified from the other thread about this that I found that IPv6 is working as intended.

My server specs are:
Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz (2 cores)
2gb of RAM
Gigabit Networking

This seems abnormally slow and I don’t really feel like any content is actually being cashed as these loading times persist through reloads however from everything I can tell the APCu and Redis cache are working as intended, at least there are no errors regarding it to be found.

If there’s any more info you need I’ll be happy to provide it!

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

<?php
$CONFIG = array (
  'instanceid' => 'XX',
  'passwordsalt' => 'XX',
  'secret' => 'XX',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/home/nextcloud/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://nextcloud.example.com',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XX',
  'installed' => true,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => 'in-v3.mailjet.com',
  'mail_smtpport' => '25',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'example.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XX',
  'mail_smtppassword' => 'XX',
  'htaccess.RewriteBase' => '/',
  'maintenance' => false,
  'default_phone_region' => 'DE',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
  ),
  'defaultapp' => 'files',
  'loglevel' => 2,
);

My Apache2 virtualhost config:

<VirtualHost *:80>
	ServerName nextcloud.example.com

	RewriteEngine on
	RewriteCond %{SERVER_NAME} =nextcloud.example.com
	RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>

	SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/nextcloud.example.com/fullchain.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/nextcloud.example.com/privkey.pem

    # enable HTTP/2, if available
    Protocols h2 http/1.1

    # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
    Header always set Strict-Transport-Security "max-age=63072000"

	DocumentRoot /var/www/html/nextcloud/
	ServerName  nextcloud.example.com

	ProxyPreserveHost On
	ProxyRequests Off

	<Directory /var/www/html/nextcloud/>
		Require all granted
		AllowOverride All
		Options +FollowSymLinks
		Options MultiViews
		<IfModule mod_dav.c>
			Dav off
		</IfModule>
	</Directory>
	
</VirtualHost>

# modern configuration
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder     off
SSLSessionTickets       off

SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"

take a look at official server tuning article.

I noticed my Apache-based docker installation feels much faster after I changed memory limit from 512M to 1024M

Hmm those are good suggestions only that I’ve actually already applied all of the sections from that page and the problem persists :frowning:
I could try increasing the memory limit but I only have 2 gigs on the server and it’s already hovering on 60-75% on idle

Edit: just tested and same issue with 1024 memory limit

So I may have it figured out, testing my web interface speed I’m getting about 4.5 seconds with cloudflare proxy enabled and 1.3 without it. Huge difference I wouldn’t have thought

1 Like

I do a test installed owncloud and Next cloud in same server same server requirement, owncloud web-interface is super fast while Nextcloud takes century to respond