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
Add routing table metrics + tweaks + fixes #261
Conversation
kdeme
commented
Jun 29, 2020
- routing table metrics + option in dcli
- only forward "seen" nodes on a findNode request
- setJustSeen & replace on ping AND findnode
- self lookup only at start
- revalidate 10x more
- use bitsPerHop (b) of 5
- small fix in resolve
- small fix in bucket split
- routing table metrics + option in dcli - only forward "seen" nodes on a findNode request - setJustSeen & replace on ping AND findnode - self lookup only at start - revalidate 10x more - use bitsPerHop (b) of 5 - small fix in resolve - small fix in bucket split
This PR basically tackles #183 and #206. Regarding liveness, only peers that are not "seen" yet are not forwarded in the FindNode requests, as it should be. Regarding staleness, I've done some quick testing with allowing nodes with a failed request/response to stay in the routing table until after n failures. In the somewhat naive implementation of a simple counter, and the same revalidation code, this has sort of a negative effect. Here is the state on witti with the current settings, nodes in routing table versus "seen" nodes in routing table. The setting of bitsPerHop (b) is chosen mostly based on how many nodes in the DHT, see following screenshot: The selflookup is not only done at startup for an initial list of "close" nodes. Running that continuously has not proven to increase the routing table seen nodes. |
This looks like quite a complicated way to draw a dinosaur :P LTGM |
What's the cost of a) keeping a node in the table and b) pinging it? |
also, an option might be to score nodes in the table - ie those that have "recently" been validated get a better score, so stuff like randomnodes returns high-score peers first and low-score peers only if there aren't that many |
Direct cost of a) is just memory, ENR size (which is max 300 bytes) + (duplicated from enr) data stored in b) is just a request response. And if it is the first ping, a handshake + request response (If we move to an LRU cache for the secrets, possibly not just the first ping that does a handshake). Can't give numbers in time as I haven't benchmarked this, but should be small. I think go implementation benchmarked the handshake part. |
Nodes are ordered on least recently seen in the bucket. So you could easily get the least recently validated nodes first if you want. And it would change all the time as long as the revalidation runs with a low interval, so perhaps enough randomisation. Not sure though. I guess it depends also on the application. If you want to waste more trial&error connections in favour of having maximum of nodes, or if you want to connect to the least possible but be more sure that it would work (e.g. for mobile). |