-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
perf: Lazy-load public-api dependencies to reduce baseline memory usage #5049
Merged
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
netroy
changed the title
refactor: Reduce baseline memory usage by lazy loading some dependencies
perf: Reduce baseline memory usage by lazy loading some dependencies
Dec 28, 2022
netroy
commented
Dec 28, 2022
@@ -19,6 +19,9 @@ if (inE2ETests) { | |||
EXTERNAL_FRONTEND_HOOKS_URLS: '', | |||
N8N_PERSONALIZATION_ENABLED: 'false', | |||
}; | |||
} | |||
if (inTest) { | |||
process.env.N8N_PUBLIC_API_DISABLED = 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helps with cutting down the heap usage in tests by about 15%, which in turn helps avoid OOM issues.
n8n-assistant
bot
added
core
Enhancement outside /nodes-base and /editor-ui
n8n team
Authored by the n8n team
labels
Dec 28, 2022
netroy
commented
Dec 29, 2022
netroy
force-pushed
the
lazy-load-dependencies
branch
from
December 29, 2022 11:04
40cd619
to
98daae4
Compare
netroy
force-pushed
the
lazy-load-dependencies
branch
from
December 29, 2022 11:06
98daae4
to
d031a96
Compare
netroy
changed the title
perf: Reduce baseline memory usage by lazy loading some dependencies
perf: Reduce baseline memory usage by lazy loading public-api dependencies
Dec 29, 2022
netroy
changed the title
perf: Reduce baseline memory usage by lazy loading public-api dependencies
perf: Lazy-load public-api dependencies to reduce baseline memory usage
Dec 29, 2022
ahsanv
approved these changes
Jan 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Got released with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This reduces the startup memory spike from 200MB to 150MB, and the baseline memory usage from 110MB to 99MB
PS: This is with public-api enabled, but swagger-ui disabled. With swagger-ui (which is the default), there is no reduction in the baseline memory usage, but the initial memory spike is still flattened to 160-170MB.