GithubHelp home page GithubHelp logo

Batch RPC calls to bitcoind about bwt HOT 3 OPEN

bwt-dev avatar bwt-dev commented on June 30, 2024
Batch RPC calls to bitcoind

from bwt.

Comments (3)

dpc avatar dpc commented on June 30, 2024

From my experience batching Bitcoin request at json-rpc layer is totally not worth it. Just use a threadpool.

from bwt.

shesek avatar shesek commented on June 30, 2024

Thanks for the tip!

Did you try with high-latency connections, say over Tor?

from bwt.

dpc avatar dpc commented on June 30, 2024

Did you try with high-latency connections, say over Tor?

No. The use cases I've worked with were all reasonably low latencies.

Just running this in my head, I don't see how batching would be better there either.

The optimization problem here is basically saturating IO throughput both on the network on disk of the fullnode (whichever becomes bottleneck first). Naive implementation blocking on each rpc call under-utilizes resources, wasting the time of the whole round-trip on each call.

Batching gets rid of most round-trips, but still suffers from the round-trip. Just once in N times instead of every time. A thread-pool can keep both the link/fullnode IO saturated 100% time. The amount of work (like serialization&deserialization) is roughly the same - with threadpool there's just more HTTP & JSONRPC envolope parsing, but these are minuscule.

On a long latency link like Tor, one would need more threads in the threadpool to stature the IO ... assuming high throughput. But since both the throughput and latency are (I assume) going to be low, then in practice a threadpool of 2 is going to saturate the connection.

from bwt.

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.