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

Reduce the number of Http Agent instances #139809

Open
2 tasks
gsoldevila opened this issue Aug 31, 2022 · 1 comment
Open
2 tasks

Reduce the number of Http Agent instances #139809

gsoldevila opened this issue Aug 31, 2022 · 1 comment
Labels
Feature:elasticsearch performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@gsoldevila
Copy link
Contributor

Born from #134362, this issue aims at improving memory footprint and performance by reducing the number of elasticsearch-js's Client instances. I identified two things that can be improved:

  • Storing and reusing instances of the same type, created using core elasticsearch service's createClient(...). If the method is called more than once with the same type and configuration, providing the same instance for subsequent calls would have two benefits:
    • Avoiding creating a new ClusterClient instance at each call. Note that ClusterClient creates: 2 es-js Client instances + 2*nbrOfNodes pools + 2*nbrOfNodes connections + 2*nbrOfNodes Http Agents.
    • Reusing the existing ClusterClient's resources (connection pools and agents, with potential idle sockets ready to dispatch requests).
  • Improving createClient(...)'s logic (or update the contract), so that the 2 ClusterClient instances (root vs scoped) are not created systematically. There are plugins that call this method and only use one of the two instances.

We find a good example of both in interactive-setup plugin: It exposes an elasticsearch service abstraction whose methods systematically createClient(...) and end up using only one of the 2 ES Client instances.

@gsoldevila gsoldevila added Feature:elasticsearch Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc performance labels Aug 31, 2022
@elasticmachine
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:elasticsearch 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

2 participants