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

V9: Fix backoffice javascript loading slowly #11714

Merged
merged 3 commits into from
Dec 1, 2021

Conversation

nikolajlauridsen
Copy link
Contributor

Details

This fixes #10252 and #11393

The problem was that, umbraco-backoffice-js.js and umbraco-backoffice-extensions-js.js loaded extremely slowly (~10 seconds for each), when the debug was set to false in the appsettings.

Turns out this was actually two separate issues, but this PR fixes both, the umbraco-backoffice-extensions-js.js problem was actually a bug in Smidge, see this for more information.

The umbraco-backoffice-js.js was simply because the Brotli compression for some reason is extremely slow, and smidge will always prefer this. This fix this issue I've replaced the RequestHelper that comes with Smidge with our own SmidgeRequestHelper which then wraps the smidge RequestHelper, but changes the default, so Smidge will now default to gzip, and only use Brotli if there is no other option.

Testing

⚠️ This only shows up if you have some App_Plugin javascript AND Debug is set to false, remember to do it in the appsettings.Development.json file ⚠️

  • Checkout V9/dev
  • Set Debug to false in appsettings.Development.json
  • Install the umbraco starter kit Umbraco.TheStarterKit
  • Launch the site and open the backoffice and notice that the backoffice js files loads extremely slow (~10 seconds)
  • Checkout this branch
  • Restore nuget dependencies
  • Rerun the site and open the backoffice, the js files now loads much much faster (1-2 seconds in my testing)

nikolajlauridsen added 2 commits December 1, 2021 15:23
By default Smidge will always try and use Brotli (br), this compression is good in the the sense that it compresses the file quite a bit, but sadly it's super super slow, like 10 seconds for backoffice js slow.
Copy link
Member

@bergmania bergmania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good..

Ill just add the link to the smidge issue, so we remember what to clean up if there is a fix in there:
Shazwazza/Smidge#135

@bergmania bergmania merged commit 980cf00 into v9/dev Dec 1, 2021
@bergmania bergmania deleted the v9/bugfix/slow_backoffice_js branch December 1, 2021 18:53
bergmania pushed a commit that referenced this pull request Dec 1, 2021
* Update Smidge

* Add SmidgeRequestHelper to override the compression order

By default Smidge will always try and use Brotli (br), this compression is good in the the sense that it compresses the file quite a bit, but sadly it's super super slow, like 10 seconds for backoffice js slow.

* Remove unnecessary new keyword

Co-authored-by: nikolajlauridsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants