Nextcloud 23 installed under Nginx: extremely slow response

Hello,

I installed Nextcloud 23, using this guide.

The installation went smoothly, but Nextcloud’s response is extremely slow, CPU/other resources are not actually used up, no relevant logs, either.

OS: Ubuntu 18.04.6
Nginx: 1.18.0
PHP: 7.4
MariaDB: 10.1.48

I would appreciate any hints on where to look for possible slowdown reasons.

It took approx. 4 minutes to load the dashboard for the first time. Most page loads time out after 300 seconds.

Restarting Web server/the whole server, re-installing Nextcloud do not help.

Hi :slight_smile:

Over which network did you try to access your Nextcloud? The loading speed is of course also affected by the available bandwith from your server to your client.

If it’s important, it’s an Ikoula-hosted dedicated server. Several other Web apps/sites are hosted on the same server, including Gitea for a very active repository with many changes posted daily.

Those sites’ typical response is below 0.2sec. The server isn’t even close to saturating its 100Mbit connection.

I doubt the issue is in network connection to Nextcloud installation.

Ok, I agree, in this case you should be able to rule out the network connection.

What is your memory setting for PHP? Do you get any warnings about it being too low in the settings?

memory_limit = 1G
post_max_size = 512M
upload_max_filesize= 512M

I can’t see whether that brings any warnings in Nextcloud dashboard, since it times out trying to load (Nginx reports error 504). Execution limit set to 300 seconds in both PHP and FCGI settings of Nginx.

Ok, that shouldn’t be the problem either…

Can you see any hints in the browser console in the network tab? I mean some specific requests that take very long or is it a general problem and all requests take that long?

General one. After the page itself (say, login page) is returned by Web server, all its components are loaded within a small fraction of a second. There are JS warnings in console (something about features that will be deprecated in Nextcloud 20… which is funny by itself), but that, again, happens after the document has loaded.

What I cannot understand is where that long pause happens - which process or operation is at fault. Firewall rules restrict several incoming ports (i.e., HTTP(S) and SSH only), other traffic is not blocked.

If anyone encountered this behavior earlier, please give any hints. I see no fun in ordering new VPSes/servers only to check whether Nextcloud 23 works on them.

Update: while I wait for the page to load, I witness no heavy operations in “top” output - none of the components (php-fpm, nginx, mysqld) are really busy, they are mostly idle

  • no related resources consumption happens

I begin to think that Nextcloud installation tries to reach an external resource(s) and this is why it is stuck. I will commence investigating the entire traffic related to Nextcloud, since I see no other things to study.

Hi, curious if you have had any update on this? I just upgraded from Nextcloud 22 to 23.0.0 and immediately it is nearly unresponsive. The dashboard loads extremely slowly with incomplete assets (missing CSS, profile image, etc.) if at all, or just gives a 504 error. It is also running on Nginx (v1.18.0).

Any advice?

Not at the moment. All my Nextcloud installations upgraded to 23 are paralyzed currently, with the same symptoms (same “504”); what I am doing now is reverting them to previous major version.

So far, I found no suspicious network-related exchange etc. that could explain the terrible delays I witness. I will continue the study shortly and, in any case, post my finding here.

Thanks for your inquiry, so I am not the only one experiencing the issue.

The slow performance you are experiencing sounds like Activating 4.2.3 app slows down Nextcloud · Issue #1887 · nextcloud/richdocuments · GitHub

Thanks, those exact symptoms. Looks like disabling Collabora is the solution ATM, I’l l do all possible checks ASAP.

Interesting - So I reverted back to Nextcloud 22 and everything is back up and working well. Per the issue that @szaimen raises, my current (reverted) configuration is as follows (and running without issue):

Ubuntu 20.4.3
Nginx 1.18.1
MySQL 8.0.27
Nextcloud 22.2.3
Collabora Online 4.2.3
Collabora Online - Built-in CODE Server: 21.11.4

I’m a little skittish about messing with the setup now that it is back online, but I guess a good test would be to duplicate to a test VM, disable Collabora and CODE server, then upgrade to NC 23 and see how it performs.

You said mariadb 10.1 ? search no longer

@nso FWIW my Nextcloud is using mySQL (8.0.27) and had the same issue when upgraded to NC 23. SO I don’t think it’s a database issue.

Hello,

I am new to NextCloud…literally installed for the first time yesterday. I have the exact same problem that is discussed here. A few details about my environment:

Running on a physical machine (2.6GHz, 8 core i7 Intel processor with 16Gb of RAM)

Ubuntu 20.04.3
PHP 7.4
MariaDB 10.5.12
Nginx 1.18

I run a few sites with this server but they are test sites and have zero traffic (aside from me :wink:

As soon as I launched NextCloud, logged in and tried to navigate around a bit things slowed down to a snail pace and then I simply get 504 errors. I check my PHP settings and even adjusted them a bit as follows:

memory_limit = 1G
post_max_size = 512M
upload_max_filesize= 512M

The machine I’m accessing is about 30 CM away from me :wink: network connectivity is not an issue.

I have Redis but for some reason cannot get it to work with NextCloud. I’m guessing (with hope) that my Nginx config requires some tweaking…

If anyone has any additional information or ideas I would be most appreciative.

Jason

P.S. A possible additionally informative piece of information…when I have NextCloud running and experience the slowdown that quickly results in 504 errors, my other PHP-based sites running on the same server also time out with 504. One site, not a PHP site, displays no slowdown whatsoever.

Just a quick follow-up in the spirit of sharing here. I got frustrated and decided to try downgrading. I deleted my DB and everything associated with NextCloud 23. Then downloaded and installed the last version of 22.

Initially, using the Nginx config file from the NextCloud documentation page (customized to my location of course) (https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html) pages on my site were broken and the site was generally unnavigable.

I deleted the Nginx config and made my own based upon other configs that work on my server.

I’m up and running now with no speed issues or 504 timeouts. :slight_smile:

My admittedly very beginner NextCloud mind tells me that there are some issues with version 23 on Nginx…?

Cheers
Jason

@jlh any chance you could share a sanitized copy of your Nextcloud Nginx config?

prplecake,

Sorry, I entirely mistook the inquiry here and posted the wrong reply. I’ve edited the original reply and below is a copy of my config with sensitive information changed.

server {

    server_name  www.mysite.com;
    root /var/www/html/mysite;
    index  index.php index.html index.htm;

    client_max_body_size 100M;

  #  location / {
  #      try_files $uri /index.php?$args;
  #     }

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }

    #// location ~ [^/]\.php(/|$) {
     location ~ ^(.+\.php)(.*)$ {
	#//	fastcgi_split_path_info ^(.+\.php)(/.+)$;
	fastcgi_split_path_info  ^(.+\.php)(.*)$;
        fastcgi_index index.php;
        fastcgi_pass unix:/var/run/php/php-fpm.sock;
        include fastcgi_params;
        include /etc/nginx/mime.types;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.mysite.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.mysite.com/privkey.pem; # managed by Certbot
    
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    #add_header X-Content-Type-Options "nosniff" always;
    #add_header Content-Security-Policy "default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';" always;
    add_header X-XSS-Protection "1; mode=block";
    
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = www.mysite.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name  www.mysite.com;
    return 404; # managed by Certbot

}