Nextcloud web interface is slow

thanks. this happens across the board, on different browsers, networks, versions.

i’m not a very advanced user, but is there a setting in my ubuntu server, maybe in the php or apache configs that makes the server ‘go to sleep’?
again, it’s not in suspend mode, but after the first time i load the cloud, the next times it’s faster. that’s until the next period of inactivity.
you know what i mean?

Maybe you have a slow database. Second time it gets the data for the database cache.

i was thinking about that. is there a way to put the database in RAM? it’s only 80 MB, and i don’t think it will ever get super big, because i’m the only user. i’m using MySQL 5.7.30 btw.

i also experimented a bit with the php and opcache memory limit. i increased them to 1GB. and i had some ok results yesterday. it did seem to be a bit faster, but today it’s lagging again.

what about changing the apache timeout / keepalive timeout settings? would that help me? i have apache 2.4.29 installed.
right now the Timeout is 300 sec, the MaxKeepAliveRequests 100, KeepAliveTimeout 5 sec.

What about using SSD instead of HDD? Makes big difference most of the time. Even with good specs I found that there are big differences between vps providers.

well, that is true, but unfortunately i don’t have the money to go for ssd right now. plus it would mean reinstalling everything. the file transfer is very fast, anyway, so it’s not necessarily a hdd thing.
more and more i think it’s about tuning the memory settings.

My configuration is slightly different (debian, mariadb, nginx) but otherwise I have similar problem as you (Nextcloud web-interface too slow). I tried everything: more and faster cpu, more ram, fast ssd, added all possible caching, tweaked php/nginx config for more servers/workers, deactivated many modules, but nothing helped.

I can not even find what actually is reason for NC web-interface being so slow. My vps is basically sitting idle, and yet NC is slow. Very slow. Any other website I tested on the same vps was blazingly fast, but not NC. I’m starting to think this is not bug, but “feature” of NC web-interface…

I think the performance is improved with newer version and no error in configuration panel. All new and correct?

Does top/htop show significant CPU activity during the wait? If not the server may be waiting for something.

I observed lags of this magnitude when there is a DNS problem on the server side. This problem may not be logged so it can be hard to spot. DNS timeout is usually 5 seconds. Try changing the DNS to 8.8.8.8 (google) or some other public server. You can also change the timeout in resolv.conf.

htop shows very little cpu / memory activity. around 1-2 % with short spikes from time to time. and around 1GB of ram.

but i think you gave me an interesting idea. i have been using Cloudflare Free DNS because it’s more private, but i remember i used to have some issues on the phone with it - sometimes everything would go much slower. let me go back to my ISP DNS server and see if there’s a change.

Do you host your service with Cloudflare Services (CDN)? I think that make no sense. Also you can perhaps allow additional ip-addresses to nextcloud to see the difference between dns and no dns.

Than you use actually Ubuntu 18.0.4 LTS with older php-version. Perhaps you can switch to a new php-version or to the new Ubuntu version 20.04 LTS

Perhaps also you can temporary deactivate redis.

it wasn’t cloudlfare CDN, it was their free service which they call 1.1.1.1: https://1.1.1.1
they don’t spy on your activity as a normal ISP would. i’m big on privacy - that’s why i’m using nextcloud in the first place :slight_smile:

i had 1.1.1.1 enabled on all my devices (laptop, workstation, phone) - not the server though. but basically anytime i was accessing the cloud it was through 1.1.1.1. i’ve disabled it on all my devices and i’ll have to see if there’s a difference. so far it seems a bit faster, but let’s see.

i’ll try all your other tips and see what happens.

hmm… Serverhardware / CPU , Ram, Swap…
if it’s not the Software could it be the hardware… what know we about the hardware ?
so, what for a Computer it is ? the Webserver… an 1,8 Dualcore with 2 Gig supports not many :wink:
@reborn579 what’s your Hardware ?

if you give for php 1024MB have PHP enough to breath
and Memcache is also a bit afterburner… it load it up for faster running…

best
Blacky

these are my specs below. i would say the hardware is fast enough. php has 1024MB of memory now.

what if i try to create a ram disk and put my sql there? would that work? :slight_smile:

The server runs on a HP Z200 workstation with an intel Xeon X3470 3GHz 4 core processor, 8GBs DDR3 RAM and 3 x 250 GB Seagate HDD ST3250312CS.
I am the only user on my Nextcloud and I usually don’t perform any heavy tasks. On average, the CPU shows 1% usage and RAM about 1.5 GB. I also have 250 GB of free hard disk space available.

nope, no Ramdisk… bad play around…

hardware is well so far …

well maybe memcache,
https://docs.nextcloud.com/server/15/admin_manual/configuration_server/caching_configuration.html
include the config.php entry

install memcache in your distro and the php-memcache, i have APCu installed,
since this is installed, fly it… (nc 17.0)
try it…

there would be Ramdisk only disturb…

and if you want a bit dark theme,
https://blackysgate.de/files/folder-root/nextcloud/

well maybe memcache

i’ve already made all the settings in that link. memcache installed, and setup.

so after more tinkering i think i’ve got it. :smiley:

  1. i updated my nextcloud to 19.0. i was told on the overview page that i’m using an old version of PHP. indeed 17.2 was 4 years old. so i updated php to 7.4. i also updated mysql to 8.0 and apache to 2.4 and i already could see a vast improvement.

  2. i tuned php. i set script memory limit to -1 (i disabled it) and i setup opcache memory consumption to 4GB. i found out that i had to edit the php.ini file in the apache2 folder of php, not the cli.

  3. i tuned apache2 according to these guides:
    https://www.liquidweb.com/kb/apache-performance-tuning-mpm-directives
    https://www.tutsandtips.com/server/apache-localhost-loading-very-slow-here-is-the-solution

  4. i tuned mysql according to this guide here:
    https://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization

  5. i disabled IPv6 on the server

  6. i switched to the performance governor in cpufreq
    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/power_management_guide/cpufreq_governors

  7. i also noticed that nextcloud is just much faster on chrome / chromium / vivaldi. i always use firefox to browser, but it seems that in this case there is a big difference in speed.

now the server is very fast. i’ll be checking it out for a few more days, but i think it should work.
funny that i solved my own problem, but at least other people who will have the same issue can just use this thread to figure it out.

AFTER A FEW DAYS
there is still a slight lag when i come back to nextcloud after a few hours for the first time, but it’s definitely much much better. and the next page loads are very fast. so i think all the settings above did help out.

just note that i am the only user on my server, and the server is dedicated to nextcloud. so depending on your situation, my solution might not work.

cheers guys! :slight_smile:

2 Likes

:+1: well Done :slight_smile:
i wish you many fun and a long lived Webserver :nerd_face: :blush:

1 Like

Thanks alot for your hints! Helped me a lot!

What I’ve found on other pages was this guide

This helped me also out very much.