Pages load really, really slowly

Hello everyone,
I’m back in touch :slight_smile: this time about the performance. My Nextcloud AIO is unbearably slow. Loading a page e.g. files or notes takes 25 - 30 seconds. I don’t think it can be due to my hardware. I am running the newest AIOin a virtual machine (ubuntu). The virtual machine now has 8 CPU cores assigned and 16GB RAM. I think the prerequisites should actually fit, it should be something in Nextcloud itself. Is there anything to recommend here? [Server tuning — Nextcloud 15 Administration Manual 15 documentation](https://nextcloud tuning)
Nextcloud was already so slow before I started installing apps.

Is there any way I can access Nextcloud locally to perhaps eliminate the internet connection? That must be possible somehow?

To answer that, you’ll need to share your Nextcloud config and give us a better idea of your AIO environment (where is it in relation to you? Are you using a proxy? Etc.

I would start by checking your:

  • browser console
  • browser console Network tab
  • Nextcloud Server log

Also, the linked docs are for v15 which is ancient. Go to https://docs.nextcloud.com and get the current docs.

Thank you for getting in touch. I am still new to Nextcloud and therefore I am still struggling with many things. Thanks for the link to the new documents…
What do you exactly mean with “browser console”? This debug tools in firefox? And then a screenshot from them when I load a side?
Yes I am behind a proxy. The proxy receives the request for the domain and then forwards it to the VM where AIO is running. Is there a possibility that I can connect diretly to nextcloud? With my local IP?

I have the same issue. I haven’t solved it, but I discovered something that could be of help to you as well: When I connect my laptop to the internet using my phone hotspot and connect to my nextcloud server it works just fine. However, when I am connected to my local wi-fi it’s unbearably slow, like you describe.

This means that the problem is not with Nextcloud itself, since it works fine when coming from the WAN side of the router, rather it probably has to do with the routing on my internal LAN. I will continue investigating.

I don’t know if this is relevant for your case, but at least it could be a troubleshooting step that you can try.

It probably routed from your LAN to your public IP and then back where it is forwarded to your Nextxloud. The bottleneck is then your router. Setup LAN side DNS so you Van route trafic internal only.

1 Like

Thanks for your infos but this is what I have already try, with an local DNS entry. But it still takes about 20 seconds to switch from files to notes, for example.

It depends entirely on your setup. If your Proxy is doing the HTTPS and the VM “only” HTTP, I would recommend still go through your proxy. However if you have configured the proxy to do SSL passthrough, you can setup DNS pointer on LAN side DNS to point directly to the IP of the Nextcloud VM.

First I would change my hosts file on a workstation so it points directly to the Nextcloud VM and test performance between that one machine and your NC. If still slow, you will need to debug the host machine running the VM and then look into caching.
If NOT slow after that, look into your proxy setup and change your hosts file on the workstation to point to the reverse proxy IP instead of directly to the MC VM (or setup local LAN DNS to point directly to NC VM IP). If slow when going through the reverse proxy (I would personally prefer that all trafic to my NC routes through the same parts as I then can harden my IPtables and monitoring and focus on as few spots as possible): you need to go over your reverse proxy setup. If not slow: Setup LAN side DNS and point the domain name for your NC to the reverse proxy.

Hi Kerasit, thank you for your time.

My reverse proxy forwards the https://mydomain.com to http://192.168.1.12:11000
I have now made a local DNS entry in my OpenWRT router so that the domain now points directly to the proxy and no longer comes via the Internet. But it is still slow inside Nextcloud…
I am now failing to connect directly to http://192.168.1.12:11000 as you described. I thought it it is not possible to diretcly log in on the AIO Nextcloud without using the domain name. Unfortunately, I have not yet understood what I have to set up to log in directly to the VM on Nextcloud.
When I call up http://192.168.1.12:11000 I am redirected to https://mydomain.com and then the connection is probably via the proxy again I think.

You need to add the IP adress to trusted domains in your config.php

But instead find the file on your workstation/laptop called hosts

On Windows:
C:/System/drivers/etc/hosts (or maybe system32)

On Linux:
/etc/hosts

Yes it has no file ending.
Add the following to the end of the file:

182.168.1.12 mydomain.com

Now go to your browser:

Http://mydomain.com:11000/

You also has the overwrite set in config.php, meaning that Nextcloud enforces https, so this test is very difficult to do unless you turn off https on the Nextcloud AIO entirely, during the test period.

I am not sure what I have to change in config.php. Do you mean this settings?

Change from the domain to the IP adress and change https to http looks like so`

  'overwritehost' => '192.168.1.12',
  'overwriteprotocol' => 'http',

And in trusted domain like this?

  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'mydomain',
    2 => '192.168.1.12',

At the end I have to restart all containers right?

1 Like

This is actually the correct way in case of AIO

You have set a LAN DNS pointer in your router DNS. Good so far. Now you do not need to fiddle around with hosts file.

Now it is correct that you will need to restart your aio NC container or at least restart php-fpm (I assume the AIO is using fpm at least). But the easiest command is just to restart the container.

Now you got two things to be aware off. One: you accepts http in your NC - and this is important: using your domain as usually as you have setup the DNS A record. Have in mind that dependant on DNS caching and your DHCP setup, you need to verify that domain is now translated correctly to the IP. If on Windows, just do nslookup mydomain.dom in a command prompt and see the returned DNS server and the IP of the domain. If the DNS is your Router and the IP is as expected, you can now proceed and be aware of the second thing:

Secondly: you are binding trafic to your NC in a none-standard HTTP port (80) so you need to add that in the url every time you access bypassing your reverse proxy (http://mydomain.dom:11000/).

Comment/question: You should be able to use port 80 still on the host that runs the container, unless that is bound already to another service ofc?

Ok just to be on the safe side :slight_smile:

  1. The nslookup to my domain should show the IP from the router, proxy or VM directly?

  2. Should I now set port 80 additionally or change the “apache port” from 11000 to 80, I haven’t quite understood that yet.
    So in the docker-compose file under “ports” or in the env the apache port?
    This apache binding that I currently have at set 0.0.0.0 is correct furthermore?

The nslookup should show the IP you setup ik openwrt DNS.

The DNS responder IP should be your router.

For now dont do any changes to your Docker settings. Just remember to add the port to the url you type in your browser.

Okay, I’m stumbling. I have now done the following, but when I start the container via AIO Admin View, my settings in config.php are overwritten again …

  1. OpenWRT Router DNS entry for mydomain → 192.168.1.12 (VM IP). nslookup on my linux shows the VM IP
  2. change https to http in config.php
'overwriteprotocol' => 'http',
  'overwrite.cli.url' => 'http://mydomain/',
  1. open in browser http://mydomain:11000 and the page cannot be displayed.

Then I noticed that after starting the container, https was entered again in point 2.
Have I overlooked anything else? I have now made the DNS entry for the domain back to the proxy IP again so that I can now log in again.

That is probably controlled by the AIO. Here you needs help from someone who knows the docker image.

Thank you so much for your help. I have now figured something out, sorry I didn’t try this earlier.
I have now tested access from my smartphone in Firefox. The speed is great both on the LAN and from the WAN. So my infrastructure/Installation should be ok…
On my notebook I test with Firefox and Chromium and both are slow.
I have now used Firefox in one of my test VMs and the speed is also great…
So I must have a problem on my notebook that affects both Firefox and Chromium :woozy_face:

EDIT:
It’s really unpleasant for me what it was at the end now … I have a Tuxedo notebook. It has a Control Center where you can set different profiles for the CPU, fan, etc. At some point, probably a long time ago, I must have set the “Powersave” profile there. This also throttles the CPU. I have never actually noticed this when surfing or working on the notebook. Now with Nextcloud it was just extreme…
I have now set “Performance” with maximum CPU and have loading times in Nextcloud of 3-4 seconds instead of 20-30 seconds. Insane… but I learned a lot with our discussion now :smiling_face:Thank you very very much.

2 Likes