goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.63k stars 911 forks source link

Slow loading of login UI #10743

Open rizwan95 opened 3 months ago

rizwan95 commented 3 months ago

Describe the bug The loading of the login UI is very slow. Can we defer the loading of unnecessary JS and resource files?

mmospanenko commented 3 months ago

also 2024.6.2 has regression - dark theme has white background on login page

image
KiARC commented 3 months ago

The admin UI is pretty slow too. It's taking upwards of a minute to load for me, and it isn't the connection nor the server nor the client since other apps hosted by the same server accessed by the same client over the same connection load instantly.

student-jie1 commented 3 months ago

ME TOO

KiARC commented 2 months ago

Profiling this with Firefox's Developer Tools shows that there is a phase that only ends when the page is manually reloaded where a DocumentLoad occurs (taking 35 seconds, yikes) but no Paint ever seems to fire, causing a RefreshDriver tick to hang (with the status "waiting for paint"). There is also a hanging SetStyleNeedFlush. I hope this issue gets some more attention because my instance is barely usable at the moment.

BeryJu commented 1 month ago

@KiARC what hardware is your authentik instance running on? It is very odd that the document load takes that long (since that itself has very little logic, usually the API requests the frontend makes take the most time)

KiARC commented 1 month ago

My instance is a docker container inside of a Proxmox VM on a refurbished HP Z640 Workstation. That shouldn't be an issue, especially since tons of other services run perfectly fine (including OneDev which is presumably at least as heavy as Authentik). Authentik is the only service with this issue among dozens of different services.

KiARC commented 1 month ago

Also, this generally gets worse over time. Sometimes destroying and recreating the compose stack mitigates it temporarily, but after several hours the problem resurfaces and the load times get longer and longer reaching nearly a minute before becoming entirely nonresponsive.

KiARC commented 1 month ago

Looks like there's an API request to /api/v3/root/config taking 20+ seconds, and another to /api/v3/core/brands/current with a similar length. Also, lots of JS chunks are taking 2-3 seconds to load each, and there are dozens of them waiting.

I am also getting tons of failed requests (522 errors) with NS_ERROR_CORRUPTED_CONTENT. Repeatedly reloading seems to almost fix it but it takes several minutes. Manually resending those requests then reloading with cache seems to work best.

Something seems to be very messed up with the frontend but I can't tell if it's just authentik or an issue on my server somehow. Seems unlikely since other services are unaffected.