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

fix: node discovery extended, empty host info bug fixed, logging enhanced #121

Merged
merged 4 commits into from
Jan 6, 2022

Conversation

yilmazbahadir
Copy link
Contributor

@yilmazbahadir yilmazbahadir commented Dec 26, 2021

fixes #120

What was the issue?

As described in issue #120 Statistics-service was not able to discover and list all the nodes in the network. It was using some static node list in the configuration to query the node/peers and those queries were being fired at the same time therefore most of them was timing out.

What's the fix?

  • In addition to the static node list in the configuration(env vars), we are now adding all the nodes in the database to the list and running node/peers API calls in this large list.
  • Calling node/peers endpoint in chunks now, handling the next chunk after the current one is complete, the default chunk size is 50, but it's configurable through the env var NODE_PEERS_REQUEST_CHUNK_SIZE
  • ChainHeight monitoring task is refactored to process nodes in chunks
  • Logging is enhanced
  • Known issues => Clean up stale nodes from DB #122


for (const nodes of nodeListChunks) {
logger.info(`Getting node info for chunk of ${nodes.length} nodes`);
await runTaskInChunks(this.nodeList, this.nodePeersChunkSize, logger, 'fetchAndAddNodeListPeers', async (nodes) => {
Copy link
Member

@AnthonyLaw AnthonyLaw Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The this.nodeList will contain all types of nodes.
Should it just use apiNodeList instead of this.nodeList to request the NodePeers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I specifically created the apiNodeList for this use, must have been regressed during the refactoring, fixed now.

});
logger.info(`[getNodeList] Nodes count from DB: ${nodesFromDb.length}`);
// adding the nodes from DB to the node list
this.addNodesToList(nodesFromDb);
Copy link
Contributor

@OlegMakarenko OlegMakarenko Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like dead / disconnected nodes can stay in the list forever, or do we exclude them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a known issue, explained in the PR description, addressed in issue #122

@AnthonyLaw
Copy link
Member

Look good mate.

but I believe we need this solution asap #122.
It will affect the node count issue here

this.nodeList.forEach((node) => this.nodesStats.addToStats(node));

@@ -17,6 +17,8 @@
"PEER_NODE_PORT": 7900,
"REQUEST_TIMEOUT": 5000,
"NUMBER_OF_NODE_REQUEST_CHUNK": 10,
"NODE_PEERS_REQUEST_CHUNK_SIZE": 50,
"CHAIN_HEIGHT_REQUEST_CHUNK_SIZE": 10,
"PREFERRED_NODES": ["*.symboldev.network"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in the discord, here is the issue created. #125

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

Successfully merging this pull request may close these issues.

Statistic service does not discover all nodes in the network.
4 participants