-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Use a single require-in-the-middle
hook
#178285
Merged
pgayvallet
merged 5 commits into
elastic:main
from
pgayvallet:kbn-xxx-single-intercept-hook
Mar 13, 2024
Merged
Use a single require-in-the-middle
hook
#178285
pgayvallet
merged 5 commits into
elastic:main
from
pgayvallet:kbn-xxx-single-intercept-hook
Mar 13, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pgayvallet
added
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
release_note:skip
Skip the PR/issue when compiling release notes
v8.14.0
startup-time
labels
Mar 8, 2024
/ci |
Tests are failing because of elastic/require-in-the-middle#79, I guess we will have to fix that upstream before going forward |
trentm
reviewed
Mar 12, 2024
/ci |
Pinging @elastic/kibana-core (Team:Core) |
jbudz
approved these changes
Mar 13, 2024
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport:skip
This commit does not require backporting
release_note:skip
Skip the PR/issue when compiling release notes
startup-time
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
v8.14.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Doing investigations on Kibana startup time, we discovered that the usage of
require-in-the-middle
has some significant performance drawback for initial start / module load time.After investigating, we discovered that the perf hit of the library is directly related to the number of hooks that are being defined (as the patching logic is executed once PER hook, surprisingly).
I will be opening an issue upstream to discuss about the problem, but for now, we'll be working around it from there.
This PR brings some perf improvements by changing the way we're using the lib, and using a single hook now delegating to the various patching methods instead of creating one hook per module patch.
Perf gain
Tests were only performed locally (we will confirm in other environments once the PR is merged), but the results are quite encouraging.
Without the PR
With the PR
So TLDR: ~18% in term of initial code loading time.
Thanks to @dgieselaar and @rudolf for the group effort on the investigation