Code Monkey home page Code Monkey logo

Comments (4)

JoshMock avatar JoshMock commented on June 7, 2024 1

Depending on how many concurrent open connections your code is making to Elasticsearch, and how your Elasticsearch instance's networking is configured, this is more likely a networking error when connecting with Elasticsearch than a bug in the client code itself.

If you intend to index thousands of documents at once, you can do it much more efficiently the bulk API or the bulk API helper, which lets you index many documents per request rather than one request per document, lowering the networking overhead significantly.

It looks like you tested this in multiple versions of Node.js, but I did also want to point out that there was a bug in Node 20.0.0 that caused a socket connection timeout error, which was patched in 20.3.0.

I'm going to close this for now. Feel free to reopen with more details if your problem persists.

from elasticsearch-js.

sibelius avatar sibelius commented on June 7, 2024

it also throws like this

ConnectionError: Socket connection timeout
at SniffingTransport.request (/usr/src/app/node_modules/@elastic/transport/lib/Transport.js:528:31)

from elasticsearch-js.

sibelius avatar sibelius commented on June 7, 2024

we are at node 20.2.0

how many concurrent inserts are a problem? 1k? 10k?

can I use something like a pool? like this

#16 (comment)

from elasticsearch-js.

JoshMock avatar JoshMock commented on June 7, 2024

The HTTP Agent in @elastic/transport has keepAlive enabled by default, so existing connections can be reused. If you want to create and manage your own connection pool, the docs have several examples for how to do so.

As for how many concurrent inserts are a problem, it depends on how your Elasticsearch instance is configured and what resources are available to it. High amounts of concurrent requests are bound to available CPU threads. High indexing pressure can use a lot of memory, too, but is dependent on how indexing_pressure.memory.limit is configured and defaults to 10% of available heap.

In your particular case, I'm also noticing that you have configured requestTimeout to 3 seconds, where the default is 30 seconds. This could also lead to the RequestAbortedError you're experiencing, if Elasticsearch is unable to respond in under 3 seconds. Try removing that setting to see what impact it has.

from elasticsearch-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.