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

Improve server_preboot execution time #109059

Closed
afharo opened this issue Aug 18, 2021 · 5 comments
Closed

Improve server_preboot execution time #109059

afharo opened this issue Aug 18, 2021 · 5 comments
Labels
apm:performance APM UI - Performance Work performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@afharo
Copy link
Member

afharo commented Aug 18, 2021

As a follow up to #108950 where we noticed that server_setup doubled its execution time in the past 30 days, affecting Kibana's total startup time, we now want to pay attention to any improvements we can apply to server_preboot to reduce the consistent 12s it takes to run:
image

After #108950, Kibana's total startup time is primarily affected by this step (approx 2/3s of the total time is taken by this step). If we manage to reduce it, it will be a huge win overall.

@afharo afharo added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc performance apm:performance APM UI - Performance Work labels Aug 18, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@afharo
Copy link
Member Author

afharo commented Aug 18, 2021

After a quick research, I noticed this is the method where the preboot phase spends most of its time:

await this.handleDiscoveredPlugins(plugin$);

It's going through all the plugins and generating their valid config with the provided schema. Each plugin takes, on average, 100ms in this process, and Kibana currently boots up with 100+ plugins, so it multiplies.

I think that the only possible action points here are to either:

@mshustov
Copy link
Contributor

After a quick research, I noticed this is the method where the preboot phase spends most of its time:

@afharo did you test it in dev mode? If so, IIRC Kibana spent most of the time compiling plugins code with @babel/register

@afharo
Copy link
Member Author

afharo commented Aug 18, 2021

@mshustov you are right! It's taking longer to run plugin.getConfigDescriptor() (that has a require() inside)

const configDescriptor = plugin.getConfigDescriptor();

than to run isEnabledAtpath (that internally validates the config)

const isEnabled = await this.coreContext.configService.isEnabledAtPath(plugin.configPath);

Well spotted.

@pgayvallet
Copy link
Contributor

We did a lot of perf improvement on our whole startup time earlier this year, I think we can consider this one done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:performance APM UI - Performance Work performance 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