-
Notifications
You must be signed in to change notification settings - Fork 346
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
Tendermint RPC Batch Requests #1298
Comments
Oh, very interesting. I never came across the batching in Tendermint or the JSON-RPC spec. Thanks for bringing that up. I'd love to integrate this here when it is working well. Some hints for implementation:
|
Thanks for the rapid response @webmaster128. Very useful to know about the future of the websocket client, I was getting a little tempted by that one. Have been exploring some ergonomics of the API design in our apps, and the way that the HttpClient integrates with the QueryClient and extensions. The issue is that the standard interfaces, eg This would have some generic behaviour which batches and dispatches RPC requests, perhaps on some user-defined timeout - 50/100ms or something. Potentially with further batching logic that could take into account request paths etc. This way you can create some singleton instance of your client with whatever store your FE framework uses, and continue to use the standard query interface, without having to worry about how requests are batched. Thoughts? |
Ah, so you implement the existing That would be cool and fit well with the existing infrastructure. |
See tendermint/tendermint#7677 and linked discussions for more info. |
Yup that's exactly it. Will hopefully have a prototype some time tomorrow |
FYI: here is a related discussion for a server-side implementation for CosmWasm queries: CosmWasm/wasmd#72. But it would not help for other Cosmos SDK queries. |
Man, this is genius. It will fit so nicely in the current stack and can easily become the default client as it does not change a single higher level API. |
Turns out it wasn't all that much of a lift. Got it batching all 25 FIN pairs into a single request locally. Also batching eg gov tally responses on proposal lists too. |
The HttpBatchClient was release in 0.29.0. It seems to work great, thanks again! In https://github.com/cosmos/cosmjs/milestone/18 you find a few follow up tickets for the class. If you are in the mood to grab some of them, that would be appreciated. |
This change introduces a new factory method on the `ArchwayClient` that uses an `HttpBatchClient` for batching multiple requests, reducing round-trips to the RPC endpoint. More details on how the batch client works can be found [in the original issue](cosmos/cosmjs#1298) or [in this usage tutorial](https://vimeo.com/771505975).
We (Kujira) are facing some infrastructure challenges when building UIs containing requests to multiple contracts (eg our users are looking for an overview dashboard of all 25 pairs on https://fin.kujira.app/). This causes issues managing our rate limiting and request volume when loading each one individually.
Tendermint has supported batch requests for some time now https://github.com/tendermint/tendermint/pull/3534/files#diff-6f806667d644e5723e506395dff9139df8a61d3a5f47cd2d95f9f143482a036c, which is as simple as sending an array of requests instead of a single object.
I'll be looking to extend the RPC components of cosmjs to support batch requests over the next few days so we can support this in our own apps.
I wanted to open a discussion to see if there had been any prior chat (couldn't find anything in search), if there was anything ongoing that I would be better off contributing to, and also to get a sanity check on whether this would be an acceptable thing to PR?
Thanks!
The text was updated successfully, but these errors were encountered: