Nextcloud slow response Ubuntu 16.04

After using Nextcloud since the fork from Owncloud to Nextcloud i recently upgrade to the latest release of Nextcloud (11.0) but to do this i needed to upgrade my server from Ubuntu 14.04 to 16.04 (which has native PHP7.0 support)

After this upgrade Nextcloud is responding slowly after logging in. The loading of the files takes quite some time and when i select kalender it takes 70 seconds to load the data.

Nextcloud is running on its own Ubuntu installation (1GB Ram, Single Core 2.4Ghz) the data is mounted of NFS and with version 9.x on Ubuntu 14.04 it was running fast.

I would suggest that you install Nextcloud on a virgin Ubuntu 16.04 x64 server.

But why?, do you have any experience with a dist-upgrade setup having issues?

I already had upgrade that worked without problem. Others resulted in a unstable system and several things weren’t working properly, that I figured out it takes me less time to make a fresh setup. First, I would try to figure out what’s wrong. But set yourself a time limit, you can easily spend a week-end without fixing it.

What can you check → what processes are running (top, ps -aux), who is using all the memory, which processes consume a lot of power when you are using Nextcloud (can you optimize them, are there errors reported)?

Is this a “real” computer where you can put more RAM? For all this database and caching stuff, a bit more memory can speed up the system considerably. 1 GB probably requires a certain amount of tuning. However, thanks to php 7.0 it should already be considerably faster.

It is just sleeping…

top - 12:22:28 up 1 day,  4:39,  1 user,  load average: 0.15, 0.42, 0.44
Tasks: 120 total,   1 running, 119 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1016204 total,   122556 free,   416036 used,   477612 buff/cache
KiB Swap:  1046524 total,  1011800 free,    34724 used.   394856 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                                          
1 root      20   0   37668   4944   3400 S  0.0  0.5   0:02.08 systemd                                                                                                                                          
2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                                                                                                                                         
3 root      20   0       0      0      0 S  0.0  0.0   0:01.82 ksoftirqd/0                                                                                                                                      
5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H                                                                                                                                     
7 root      20   0       0      0      0 S  0.0  0.0   0:06.18 rcu_sched                                                                                                                                        
8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh                                                                                                                                           
9 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0                                                                                                                                      
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.32 watchdog/0                                                                                                                                       
   11 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs                                                                                                                                        
   12 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns                                                                                                                                            
   13 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 perf                                                                                                                                             
   14 root      20   0       0      0      0 S  0.0  0.0   0:00.03 khungtaskd                                                                                                                                       
   15 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback                                                                                                                                        
   16 root      25   5       0      0      0 S  0.0  0.0   0:00.00 ksmd                                                                                                                                             
   17 root      39  19       0      0      0 S  0.0  0.0   0:00.36 khugepaged                                                                                                                                       
   18 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 crypto                                                                                                                                           
   19 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd                                                                                                                                      
   20 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset                                                                                                                                           
   21 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kblockd                                                                                                                                          
   22 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 ata_sff                                                                                                                                          
   23 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 md                                                                                                                                               
   24 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 devfreq_wq                                                                                                                                       
   28 root      20   0       0      0      0 S  0.0  0.0   0:00.11 kswapd0                                                                                                                                          
   29 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 vmstat                                                                                                                                           
   30 root      20   0       0      0      0 S  0.0  0.0   0:00.00 fsnotify_mark                                                                                                                                    
   31 root      20   0       0      0      0 S  0.0  0.0   0:00.00 ecryptfs-kthrea                                                                                                                                  
   47 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kthrotld                                                                                                                                         
   48 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 acpi_thermal_pm                                                                                                                                  
   49 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset                                                                                                                                           
   50 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset                   

root@cloud02:~# free -m
              total        used        free      shared  buff/cache   available
Mem:            992         402         123          32         466         389
Swap:          1021          33         988
root@cloud02:~# 

I have an identical machine running observium and mediawiki (also upgrade from 12.04 to 14.04 to 16.04) and it does not have this slow behaviour.

I also found out the some process seem to login to MySQL without using the nextcloud config settings

2017-01-05T13:32:32.583763Z 10618 [Note] Access denied for user ''@'localhost' (using password: NO)
2017-01-05T13:37:47.607715Z 10686 [Note] Access denied for user ''@'localhost' (using password: NO)

But i didn`t find out which part of nextcloud is having this issue.

It is not caused by the nextcloud cron since it is running every 15 minutes

Hard to say, but such a long response time looks like Nextcloud is waiting for something until it runs into a timeout or a fallback. Cache-Server are correctly linked? ipv6 or network in general? Worst case is to go down and run certain processes in debug mode. You will get tons of messages and you need to spot the right one :smiley: