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

Migrate elasticsearch client to the new undici http client #116087

Open
mshustov opened this issue Oct 25, 2021 · 3 comments
Open

Migrate elasticsearch client to the new undici http client #116087

mshustov opened this issue Oct 25, 2021 · 3 comments
Labels
enhancement New value added to drive a business result Feature:elasticsearch impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@mshustov
Copy link
Contributor

mshustov commented Oct 25, 2021

Blocked on elastic/elasticsearch-js#1740

#108387 follow-up

elaticserarch-js client starting from v8.0 uses undici as a default HTTP client. undici has been rewreitten from scratches to supersede the standard http module of nodejs. Undici has significantly lower memory pressure and runtime overhead, comparing to the standard http module.

During the client version upgrade, I decided not to use undici client in the ES client for the following reasons:

@mshustov mshustov added Feature:elasticsearch Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc enhancement New value added to drive a business result labels Oct 25, 2021
@elasticmachine
Copy link
Contributor

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

@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Nov 1, 2021
@mshustov mshustov added impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort and removed loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. labels Nov 2, 2021
@gsoldevila
Copy link
Contributor

gsoldevila commented Jul 29, 2022

There's an initiative to monitor and track the number of open sockets with the standard 'http' client. The goal is to have some visibility on that value, and to be able to fine-tune the value of maxSockets (which is set to Infinity at the time of writing).

If/when we resume efforts to test (and to switch to) the undici implementation, it is worth noting that the undici.Pool used by elasticsearch-js's UndiciConnection has a get stats() method, that should allow to continue tracking the number of open sockets.

Then, in terms of configuration:

undici client doesn't support keepAlive and maxSockets options

I believe undici is keepAlive by default, and it does support agent.connections: number which allows defining an upper limit to the number of open connections in the pool (or so it seems).

@trentm
Copy link
Member

trentm commented Aug 11, 2022

  • APM agent is going to add support for undici client after v8.0

Undici support (and testing using the UndiciConnection with @elastic/elasticsearch) is now in the APM agent: [email protected] (elastic/apm-agent-nodejs#2872)

@pgayvallet pgayvallet changed the title Migrate elasticsearch client to the new http client Migrate elasticsearch client to the new undici http client Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:elasticsearch impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort 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