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

[core] avoid doing plugin discovery when bootstrapping the dev server #79037

Closed
spalger opened this issue Sep 30, 2020 · 8 comments
Closed

[core] avoid doing plugin discovery when bootstrapping the dev server #79037

spalger opened this issue Sep 30, 2020 · 8 comments
Labels
Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@spalger
Copy link
Contributor

spalger commented Sep 30, 2020

When running the dev server locally, before the platform code loads up the ClusterManager it runs plugin discovery which loads all the plugin source code. This seems like it might be necessary to get the configuration validated, but shouldn't be necessary just to get the ClusterManager running. Hoping someone on the platform team would be able to take a look at ways we could avoid running plugin discovery when env.isDevClusterMaster is true.

Skipping plugin discovery would likely allow us to disable the babel-register cache in the parent process of the dev cli or at least would make loading the parent process much faster.

@spalger spalger added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Sep 30, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@mshustov mshustov added enhancement New value added to drive a business result and removed enhancement New value added to drive a business result labels Oct 1, 2020
@mshustov
Copy link
Contributor

mshustov commented Oct 1, 2020

There are already quite a few places disabling different platform functionality based on env.isDevClusterMaster (http server listening on a port, plugin initialization, etc.)
Probably we should change the way we create ClusterManager not to bootstrap the platform at all? More details on why we need ClusterManager: #78710

@pgayvallet
Copy link
Contributor

pgayvallet commented Oct 1, 2020

Probably we should change the way we create ClusterManager not to bootstrap the platform at all?

Yea... atm starting the ClusterManager is the last thing we are starting, as the legacy service is one of the last to start.

Before we removed we legacy plugin system, the legacy plugin discovery was required to enhance the legacy config, and the legacy discovery had to run after the KP plugins discovery.

return new ClusterManager(
this.coreContext.env.cliArgs,
config,
await basePathProxy$.toPromise()
);

Now that this is gone, we could probably improve that. Ideally for that, ClusterManager would accept the KP configuration instead of using the legacy one. The clusterManager could even load the config itself now that the kbn/config package is (almost) a thing, avoiding to even load core.

@spalger
Copy link
Contributor Author

spalger commented Oct 1, 2020

By the way, I took a stab at disabling plugin discovery via env.isDevClusterMaster by preventing discover() from being called and it's working pretty well from what I can tell. The core is relatively tiny when it doesn't do any discovery so I think this might be a suitable solution if I can get platform sign off in the PR.

@spalger
Copy link
Contributor Author

spalger commented Oct 5, 2020

Closed by #79358

@spalger spalger closed this as completed Oct 5, 2020
@mshustov
Copy link
Contributor

mshustov commented Oct 6, 2020

reopen as we still need to decouple dev tools and ClusterManager from the platform code

@mshustov mshustov reopened this Oct 6, 2020
@spalger
Copy link
Contributor Author

spalger commented Oct 7, 2020

I feel like that deserves its own issue personally.

@mshustov
Copy link
Contributor

mshustov commented Oct 8, 2020

@spalger ok, closed in favour of #76935

@mshustov mshustov closed this as completed Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

4 participants