nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.11k stars 3.93k forks source link

NC loading is horrendously slow (after the 2FA pin validation) #6817

Closed GLLM closed 6 years ago

GLLM commented 6 years ago

Steps to reproduce

  1. Open a browser with an emptied cache (e.g. Incognito mode)
  2. Open nextcloud url
  3. login with user + password + 2FA 3bis. also reproduced when already logged and simply pressing CTRL+F5

Expected behaviour

it should load way faster :) It was faster in NC 11 (and I think in patches < 12.0.3)

Actual behaviour

Time between 2FA validation in the login screen and nextcloud availability is between 1 to 5 minutes It seems that everytime the loading of core.js is the first item to be stuck (in firefox performance analyser) and all the below resources below are stuck as well

Screenshot is done when the loading finally ends 2017-10-04_10-19-59

Everything works very fine after this !!

Server configuration

Ubuntu 16.04 Apache 2+ Letsencrypt HTTPS certificates MySQL PHP 7 Nextcloud 12.0.3 Updated from 10 > 11 > 12.0.2

Signing status: No errors have been found.

List of activated apps: will try to upload this later

Nextcloud configuration: External storage : NO Encryption: NO (dreaming of the E2EE ;)

External user-backend : Webdav (Cyberduck, just testing, not using a lot)

Client configuration

Browser: Firefox 56.0.4 Operating system:Windows 7 or Windows 10 Using Android clients (latest stabel version) but no desktop clients

Nextcloud log (data/nextcloud.log)

Loads of : Warning l10n Failed to load url/nextcloud/apps/polls/l10n/fr.json - json error code: 3 Memcache \OC\Memcache\APCu not available for local cache Memcache \OC\Memcache\APCu not available for distributed cache Nothing more

Browser log

Content Security Policy: La directive « frame-src » est obsolète. Veuillez utiliser la directive « child-src » à la place. nothing more of importance.

** edit for typo corrections

nickvergessen commented 6 years ago

30 seconds sounds like the bruteforce-protection kicked in. Can you have a look at the oc_bruteforce_attempts table in the database and check if you have too many fail attempts in there? You can also simply remove all content from that table to test it.

GLLM commented 6 years ago

Additional info : server is running perfectly fine for hosted site, syncthing, rss aggregator, ...

GLLM commented 6 years ago

@nickvergessen Indeed, bruteforce protection was installed but I considered that having 2FA was secure enough. I un-installed it but i'm not sure I emptied the DB. I'll check it.

Oh, and it 300s, not 30s ;)

GLLM commented 6 years ago

I emptied the bruteforce tabel and tried again with CTRL+F5 It's currently loading

image

There are another ~50 GET request waiting to be done, in addition to the one pending visibel in the screenshot.

GLLM commented 6 years ago

5min later, the loading ended ! Thanks to my screenshot tool, i know that my previsou one was taken @ 5pm54. And the below one @ 5pm59 --> 5min loading

image

j-ed commented 6 years ago

@GLLM Wouldn't it be possible that the missing APCu memory cache is causing the lazy loading? For a Nextcloud installation APCu or Redis are recommended as far as I understood.

https://docs.nextcloud.com/server/12/admin_manual/configuration_server/caching_configuration.html

GLLM commented 6 years ago

@j-ed, I'll double check but in all cases : I dont expect such huuuge load timings.

Edit : btw anyone knows why I keep on setting the MemCache path as '\OC\Memcache\APCu' in config.php, and Nextcloud keeps at setting it back to '\OC\Memcache\APCu' ? It is annoying.

Update : no impacts.

GLLM commented 6 years ago

I still have the same issue ... :)

GLLM commented 6 years ago

One additional note : this slowness seems to be much improved when I revoke old sessions (which have not been auto removed). When done, the login is much faster. I noticed that the sessions present in numerous amount are that of brower sessions, that I may have not logged out properly.

I try to log out properly every time i can, but I noticed that sometimes it is quite slow to have to concurrent sessions in the same browser to log out.

Just letting ou now ... maybe browser sessions could have an autor-evoke settings ?

Thanks

uli-a commented 6 years ago

I do have the same problem. I upgraded from 11.0.5 to 12.0.3 and now NC takes about 1 minute to open a page (any page, not just the login page). The first files (until core.js) load really fast. Then it takes about a minute to load core.js and the test is loaded very fast again. I see this behaviour only in Firefox. Chrome does not seem to have this issue.

I checked the load on the web server as well, but it is close to idle.

I activated opcache and APCu after upgrading to 12.0.3 to fix the issue but it had no affect.

By the way: the demo page (https://demo12.nextcloud.bayton.org) is loading fast - even in Firefox.

uli-a commented 6 years ago

I did some more testing and found the difference between the demo page and my setup: I have configured the Apache web server to use HTTP/2 while the demo pages uses HTTP/1.1. Nextcloud is back to normal performance when I remove the http2 module from Apache.

For now I readded the HTTP/2 module but only use protocol HTTP/1.1 for the virtual server for Nextcloud.

While this is a good workaround for now, I would like to know, why there is a problem with the combination HTTP/2 + Firefox + Nextcloud.

j-ed commented 6 years ago

@uli-a I made similar experiences as I tried to use HTTP/2 together with Nextcloud. In my case the mod_http2 module was causing the trouble, see mod_http2(v1.10.6) causes segmentation fault.

GLLM commented 6 years ago

Thanks @j-ed @uli-a for the info/feedback and tip on http2 with Firefox. I'll check it later !

GLLM commented 6 years ago

After upgrading to Apache 2.4.29, which contains the fix on HTTP2 with apache 2.24 on firefox (see https://github.com/icing/mod_h2/issues/142#issuecomment-319077236), the slowness has completely disappeared and the site loading is as quick as it should be !! :)

image

Many thanks @j-ed