-
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
[dev/server] improve startup time and prevent OOMs on shutdown #78710
Closed
spalger
wants to merge
4
commits into
elastic:master
from
spalger:implement/default-kibana-memory-limit-dev
Closed
[dev/server] improve startup time and prevent OOMs on shutdown #78710
spalger
wants to merge
4
commits into
elastic:master
from
spalger:implement/default-kibana-memory-limit-dev
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
spalger
added
Team:Operations
Team label for Operations Team
v8.0.0
release_note:skip
Skip the PR/issue when compiling release notes
v7.10.0
labels
Sep 29, 2020
spalger
force-pushed
the
implement/default-kibana-memory-limit-dev
branch
from
September 30, 2020 19:27
1f46c37
to
2ea87d5
Compare
@elasticmachine merge upstream |
spalger
force-pushed
the
implement/default-kibana-memory-limit-dev
branch
from
September 30, 2020 23:17
87082f8
to
5766350
Compare
spalger
changed the title
[dev/server] default the max-old-space-size to 4gb
[dev/server] improve startup time and prevent OOMs on shutdown
Sep 30, 2020
Pinging @elastic/kibana-operations (Team:Operations) |
💚 Build SucceededMetrics [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
release_note:skip
Skip the PR/issue when compiling release notes
Team:Operations
Team label for Operations Team
v7.10.0
v8.0.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.
returned to draft
I'm hoping that #79052 + #79235 #79358 will make this unnecessary.
In development the kibana CLI morphs into a different tool that is designed to be helpful when working on Kibana. It's current responsibilities include:
@kbn/optimizer
in the same process, which launches webpack workers in child processesThese responsibilities are managed by the
ClusterManager
class, except for the proxy server which is managed by the core so that the HTTP interface mimics the Kibana server as closely as possible even while all requests are actually being proxied.Over the process of migrating to the KP and deprecating the legacy process the amount of work happening in the parent process has grown substantially and lead to a serious slowdown of the server. Additionally, since we use
@babel/register
and the code base has grown substantially, stopping the dev CLI often triggers an OOM unless you set theNODE_OPTIONS
environment variable to increase themax-old-space-size
of the node process. This is caused by the fact that@babel/register
maintains a cache of all transpiled code, and then synchronously at shutdown will serialize that object to JSON and write it to the file system. The massive amount of code we're asking it to transpile on the fly simply doesn't fit in memory with the defaultmax-old-space-size
of the Kibana process.In order to improve the dev CLI experience I've made three changes:
NODE_OPTIONS
to "--max-old-space-size=4096" in the environment of the Kibana server child processThese changes greatly reduce the memory requirements of the parent process, prevent the babel/register cache from being read or set in the parent process (which saves a surprising amount of time now that we don't need the cache and only load the core platform code), and increase the server processes ability to write the babel/register cache without OOMing.
Here are some stats that I collected on my computer, stats on other machines will surely vary and I'd love to see what you get.
This PR:
master: