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

Fix slow loading UI after server startup #5669

Merged
merged 1 commit into from Feb 11, 2019

Conversation

@mpfz0r
Copy link
Member

commented Feb 11, 2019

Avoid registering ShiroSecurityContextFilter as a DynamicFeature.
Doing so, triggers Jersey to create a ServiceLocator for all
existing (~1600) Resources. [1]
Furthermore, each created ServiceLocator will have its own Guice/HK2 Bridge,
whose JIT resolver cache is cold upon startup and needs to be filled.

Instead of registering the ShiroSecurityContextFilter dynamically, we
register it statically in the JerseyService because every Resource is filtered
through it anyway.
We need to give it a higher priority so it's executed before the authentication filter.

[1]
https://github.com/jersey/jersey/blob/2.25.1/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java#L187

Fix slow loading UI after server startup
Avoid registering ShiroSecurityContextFilter as a DynamicFeature.
Doing so, triggers Jersey to create a ServiceLocator for all
existing (~1600) Resources. [1]
Furthermore, each created ServiceLocator will have its own Guice/HK2 Bridge,
whose JIT resolver cache is cold upon startup and needs to be filled.

Instead of registering the ShiroSecurityContextFilter dynamically, we
register it statically in the JerseyService because every Resource is filtered
through it anyway.
We need to give it a higher priority so it's executed before the authentication filter.

[1]
https://github.com/jersey/jersey/blob/2.25.1/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java#L187
@dennisoelkers
Copy link
Member

left a comment

LGTM - loving it!

Code looks fine. Tested development & production builds, no errors regarding authentication found, no errors in the JS console.

@bernd
bernd approved these changes Feb 11, 2019
Copy link
Member

left a comment

LGTM 👍 Let's merge this into master so we can test it for real.

@bernd bernd merged commit d6decea into master Feb 11, 2019

4 checks passed

ci-web-linter Jenkins build graylog-pr-linter-check 3342 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
graylog-project/pr Jenkins build graylog-project-pr-snapshot 3053 has succeeded
Details
license/cla Contributor License Agreement is signed.
Details

@bernd bernd deleted the fix-guice-bridge-performance branch Feb 11, 2019

@lennartkoopmann

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

yesssssssss

@deeshe

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2019

We decided to remove this from the Stable Backports for now until we are more confident that it doesn't have any negative implications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.