Giter Club home page Giter Club logo

Comments (37)

rudolfbyker avatar rudolfbyker commented on July 22, 2024 1

I'm not concerned with breaking changes. We are moving towards the first major release, so I think we should be relentless. If we had a big software house backing the project, that would be a different story.

I'll check out undici and get back to you. I need to get this done today.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024 1

@rudolfbyker I don't think you strictly need to use either, original implementation just takes a plain simple Request call and wraps a Duplex (which writes to request and reads from response) around it.
Now if you would use undici.pipeline, it should do all that job for you, Dispatcher.pipeline should create exactly the kind of Duplexer that we create ourselves now.
I would recommend against refactoring this part right now, though. There are no tests, so difficult to say if we break something in a major way. I suggest doing bare minimum change (replace simple Request call with simple callback-based Undici call) for now, and later on I will write a test and attempt a proper refactoring. Does that work for you?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

x2-x3 speedup in what sense? The biggest time consumers are always sending / waiting for / receiving the network response.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I would prefer axios, because I favour maintainability. Having a well-known / popular package is better in that regard. I don't have much time left to work on this repo this month.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

This issue replaces #252

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

This issue replaces #251 , too!

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker See https://www.youtube.com/watch?v=tr057sP4VBM for more details on Undici and overall deep-dive into HTTP client performance.
Well, superagent is also a well-supported and popular library, we are talking 4 million weekly downloads vs 15 millions weekly downloads, so both of them are very mature and popular.

See https://github.com/fdesjardins/node-http-client-bench for (somewhat outdated) benchmarks.

I would still prefer using Undici if we are ok with a breaking change that would force people to redo mocks with builtin Undici mocking, but I would need your input on that.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

OK, I see the advantage for situations where you have many small requests in a short time span. Like when doing autocomplete queries.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

FYI nodejs/undici#1011

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

Undici does not support providing a custom HTTP agent. So we will have to drop that. (If I understand correctly from the, Undici IS an HTTP agent? But I'm confused about that.)

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker Yes, more or less. Since it does not use http Node module (it is more low-level than that, it operates directly on net and tls parts of Node), it does not support an http Agent either.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

Let's also get rid of the custom error types and let Undici just do its thing. Extending errors in JS is problematic at best, and so we should not force this on users of our library.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

Yeah, fair.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I'm a bit stuck on refactoring the createAddStream method. I'm not quite sure what it's supposed to do, or how to refactor the "duplexing".

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker It's a way to create a large amount of documents in bulk. Imagine that you have a billion of DB entries that you want indexed. What you might want to do is read them from DB as a stream and keep indexing them as you go.
I'm not sure you need to refactor much there, just replacing underlying Request call with Undici call should suffice. This is one case where still exposing a callback is a good idea, because that's how streams are typically consumed.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I've never worked with streams in JS before, so I'm having a hard time wrapping my head around this. Should I be using undici.stream or unidici.pipeline?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

The thumbs up was to say that I agree with the approach in principle, but I have been at this for a long time now, and can't get it to work. Do you have time to look into refactoring the createAddStream function specifically? It could even be a separate PR on its own, while everything else still uses requests.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

Sure, I'll take a look. Can you push your branch?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

https://github.com/lbdremy/solr-node-client/compare/issue-286-promises

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I will have to stop work for today, as I'm starting to feel unwell. Thanks for the great collaboration!

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker Please feel better soon!
I'll try to take it over from here. Thank you, it's fun :)

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker I assume you didn't get simple Undici requests for basic operations like search to work either yet?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

ok, I'll avoid touching those parts yet and focus only on streams

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

can you push your half-done changes as well then?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

thanks!

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

Sorry for the delay. Pushed now. See commit messages for details.

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I'm going to take another stab at this, if you haven't started.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

not yet :). thanks!

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

OK, that's all I have time for now.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

Thank you! Hopefully will be able to continue the subject this week.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker I will still add test for streaming functionality, and @AlinaKul will update the tests. Is there anything else left beyond that?

from solr-node-client.

rudolfbyker avatar rudolfbyker commented on July 22, 2024

I cannot remember. You will have to dive into this. Not sure when I will have time to continue with this one.

from solr-node-client.

kibertoad avatar kibertoad commented on July 22, 2024

@rudolfbyker Gotcha, will do! Thank you for the incredible work you've done on this!

from solr-node-client.

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.