Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very first login is very slow, aka just how many database queries do we need? #12234

Closed
jernst opened this issue Nov 2, 2018 · 5 comments
Closed

Comments

@jernst
Copy link
Contributor

jernst commented Nov 2, 2018

I've long wondered why logging into a new Nextcloud installation takes such a long time on the first time. (the slow "out-of-the-box experience".) Thanks to the mariadb query log, I know now and I would like to share. Here is what I did:

  1. Brand-new Nextcloud installation (on UBOS but this is hardly an OS-dependent issue)
  2. No non-default apps installed. Admin user provisioned, and some config defaults changed from the command-line. (Here is the script if you are so inclined; I guess if it's apparent what we do even if you don't know Perl or UBOS)
  3. Now I do I two things with a browser:
    • Access the front page
    • Log in with the provisioned account
  4. At the time the splash screen comes up, and the default set of files is displayed, I stop.

My query log reports (with the help of grep and sed):

  • 72 distinct database "Connect" events
  • 4493 database queries, which break down something like this:
    • 134: INSERT
    • 1092: UPDATE
    • 3063: SELECT
    • 4: DELETE
    • 28: COMMIT
    • 144 SET SESSION
    • 28 START TRANSACTION

Note that at this time, none of the caches are warm yet. So my question: does the number of queries really have to be in the thousands before the first user is logged on?

To reproduce: get a database shell, then:

set global general_log_file = '/tmp/mysql.log';
set global general_log = 'ON';

Note that if you run mariadb through systemd, the actual location of the log file might be in a subdirectory. Try find /tmp -name mysql.log to find it.

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #3762 (Slow login after change ldap password), #11670 (LDAP Login fails on first attempt), #9386 (I can not login!), #7471 (LDAP User First time login is disabled), and #7265 (Small adjustments needed to the login screen).

@abbasharoon
Copy link

Facing somewhat same issue but haven't debugged the issue yet. When a new user logins for the first time to NC, they don't get a response back though the user get logged in and opening the instance in a new windows loads the default files app.

Any suggestions for a workaround?

Thanks

@bs-eng
Copy link

bs-eng commented Mar 5, 2019

Facing the same issue here.
I use OMV on odroid XU4 and installed nextcloud in docker container.
The first login to nextcloud takes so long that the http server runs into time out.
After a while the nextcloud website defaults to the normal login page.
From here different behaviours can be observed (I installed fresh out of the box 6 times by now):

BEHAVIOUR 1: The initial page that ask for creating the nextcloud admin loads, I enter the settings. Then the http server time out appears after quite some time. Coming back to the same page after approx 5min gets me directly to the welcome page in the admin account, without asking login data again. From there everything click takes so long that http server timeout appears. After reloading the page at least 2 minutes later gets me to where I wanted to go.

BEHAVIOUR 2: The initial page that ask for creating the nextcloud admin loads, I enter the settings. Then the http server times out. Reloading the page gets me to the login page. Entering the admin credentials leads to returning to the login page. Effectively I never get logged in.

Interesting is that those two behaviours appear after installation in the exact same way. Parameters and order of steps are the same. Boot device was completly wiped and new partitioned before new install. Software versions seem not to have change during these days of reinstalling.

I hope this helps to investigate further.
Contact me if mor einfo is needed.

Cheers!

Odroid XU4
Kernel Linux 4.14.94-odroidxu4 (Debian)
OMV 4.1.19-1 Arrakis
Docker 18.09.3
Nextcloud latest .... so I guess as fo 2019-03-05

@creopard
Copy link

Here is a similar issue: #14632

@skjnldsv
Copy link
Member

@creopard thanks :)
Duplicate of #14632

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants