EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

Performance Optimisation of Request Latency #454

Closed jsnathan closed 3 years ago

jsnathan commented 5 years ago

I have a question about optimising the total time it takes to prepare a transaction.

I have a use case where I am submitting transactions indirectly to the blockchain after they have been signed by eosjs. I am trying to figure out how to improve the amount of time it takes to prepare the transaction for broadcasting. It seems the absolute majority of the time is spent in round-trip latency between eosjs and the blockchain, in order to get various information.

https://imgur.com/7ZXM6G0

I have a websocket connection to the web client that needs to prepare the transaction. Is there any way I can pre-cache all of the needed information, and keep it up to date, so as to reduce round-trip latency to a minimum (possibly none)? Would the easiest way be to somehow indirect the ajax requests to my cache of the information? Is all of the information needed, or can the use of some of it be avoided, possibly by relaxing client security a bit?

If you have any pointers on how to accomplish this, please let me know. Thanks.

GreenBusDriver commented 5 years ago

To really fix this, we need to rework the RPC api in nodeos

bradlhart commented 3 years ago

WIth the release of v22 stable, the new process uses get_block_info which is a faster endpoint. This is currently available in eosjs@edge and RC versions of eosjs. As for the amount of calls, it's still required unless a rework is made in nodeos.