Skip to content
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

Cache rpc results #326

Closed
kumavis opened this issue Oct 5, 2015 · 11 comments
Closed

Cache rpc results #326

kumavis opened this issue Oct 5, 2015 · 11 comments

Comments

@kumavis
Copy link
Contributor

kumavis commented Oct 5, 2015

i've been working on some alternate web3 providers that let a user run a dapp without setting up and running a node. We've noticed some dapps trigger very aggressive polling for state. Since our network requests can take a little longer to resolve, we've seen significant improvements by caching network results. The setup looks like this:

  • web3 continuously polls for the latest block
  • while the block remains the same we can cache any results regarding the state of accounts (balance, storage)
  • when the block increments, we dump the cache

we're implementing this at the provider level, but seems like something that everyone could benefit from at the web3 level

thoughts? would you merge a PR based on this?

@tcoulter
Copy link

tcoulter commented Oct 5, 2015

👍 Would love to see this behavior implemented in web3. Due to provider idiosyncrasies, would love the polling interval be configurable.

@frozeman
Copy link
Contributor

frozeman commented Oct 6, 2015

What about a chain re-org where the latest block changes?
We are actually thinking about introducing push events, so that we can get rid of this polling all together.

This would make the cache obsolete right away, so i would rather wait..

@kumavis
Copy link
Contributor Author

kumavis commented Oct 6, 2015

What about a chain re-org where the latest block changes?

re-org invalidates cache, seems pretty straightforward

This would make the cache absolute right away,

not sure what you mean

EDIT: absolute -> obsolete, ok I get it.

We are actually thinking about introducing push events

is there a gh issue for this or something to follow?

@frozeman
Copy link
Contributor

frozeman commented Oct 7, 2015

ethereum/go-ethereum#1867

Which is only one part and a proposal, but we are discussing a pushing API

EDIT, its actually only about internal events. For the real new push API exists no issue for now.

@kumavis
Copy link
Contributor Author

kumavis commented Oct 7, 2015

what do you think of http long polling for blocks?

@frozeman
Copy link
Contributor

frozeman commented Oct 7, 2015

Would require changes on both node and web3. We are already going another route (push).

@kumavis
Copy link
Contributor Author

kumavis commented Oct 8, 2015

@frozeman what protocol are you going to push over?

@fjl
Copy link

fjl commented Jul 17, 2016

@kumavis Bit late to the discussion but the answer we settled on is WebSocket. geth 1.4.x has WebSocket support and there are RPC methods for subscribing to push events on the connection. Push events are sent as JSON-RPC notifications.

@kumavis
Copy link
Contributor Author

kumavis commented Jul 17, 2016

@fjl thanks

@kumavis
Copy link
Contributor Author

kumavis commented Aug 15, 2016

@frozeman @fjl hey gents, is there an update on the websocket work? looking for an issue to follow.

@frozeman
Copy link
Contributor

frozeman commented Aug 8, 2017

@frozeman frozeman closed this as completed Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants