Giter VIP home page Giter VIP logo

Comments (8)

sksamuel avatar sksamuel commented on August 27, 2024

I guess the idea is you can pass in your own execution context if you think it might become a bottleneck.

If we move to using a Promise that we complete using an action listener, then the bottleneck moves to the underlying elasticsearch client executor, right? If so, what's the advantage?

I'm not against the idea of doing it this way, I just need to better understand the advantage.

from elastic4s.

guersam avatar guersam commented on August 27, 2024

ES java client manages it's own thread pool. If we make a blocking call in a single client-wide ExecutionContext, the intermediate thread will be blocked and the ES thread pool won't be fully utilized.

from elastic4s.

sksamuel avatar sksamuel commented on August 27, 2024

I see that we are thinking about slightly different cases.
I am using the case that people will use the client as a non data node (using transport client for example), in which case the client has its own thread pool that is no different to the a thread pool you can specify to the e4s client. I think you're using the case where your client is also a data node, in which case using ES's own thread pool might be better.
Perhaps we can solve this by adding in the callback methods you suggest, but keeping the "internal thread pool" ones as well? What do you think ?

from elastic4s.

guersam avatar guersam commented on August 27, 2024

In usual, when you send an async request via a transport client, it registers a callback on it's internal thread pool and the pool will notify when it's done. Additional requests will be handled in the same manner.

However, by blocking request inside a shared execution context, additional ones won't be sent until the previous one is done and the thread pool will hold only one request at once like this:

drawing1

from elastic4s.

guersam avatar guersam commented on August 27, 2024

There should be Elastic4s client between 'User' and 'ExecutionContext'..

from elastic4s.

sksamuel avatar sksamuel commented on August 27, 2024

Yes I see what you mean. I'll follow up tonight with some conversion work, or you can start on a branch if you want.

from elastic4s.

sksamuel avatar sksamuel commented on August 27, 2024

take a look over what I've done, feedback very much welcome.

from elastic4s.

guersam avatar guersam commented on August 27, 2024

Thanks :) I'll send a following PR in a few days.

from elastic4s.

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.