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

'delegators' and 'delegators_count' RPC commands run very slowly or not at all #1517

Closed
kilkelly opened this issue Dec 30, 2018 · 14 comments · Fixed by #2283
Closed

'delegators' and 'delegators_count' RPC commands run very slowly or not at all #1517

kilkelly opened this issue Dec 30, 2018 · 14 comments · Fixed by #2283
Assignees
Labels
quality improvements This item indicates the need for or supplies changes that improve maintainability

Comments

@kilkelly
Copy link

Issue:
When running the delegators or delegators_count RPC commands on a node the response is either very slow or can even lock up / crash the node.

Steps to reproduce the issue:
Run either the delegators or delegators_count via RPC on the node and wait for the results.

Describe the results you received:
My node never returned results and became unresponsive to further RPC commands i.e. locked up.

Describe the results you expected:
Expected to see results as documented in the Nano wiki.

Environment:

  • OS information: Linux li293-21 4.18.16-x86_64-linode118 # 1 SMP PREEMPT Mon Oct 29 15:38:25 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Nano Node version: V17.0
  • Docker: 18.06.1-ce
  • System stats: 2 GB RAM, 1 CPU Core, Linode VPS

Possible Solution:
Optimize how the delegators and delegators_count RPC commands interact with the ledger.

@zhyatt zhyatt added the quality improvements This item indicates the need for or supplies changes that improve maintainability label Dec 30, 2018
@zhyatt zhyatt added this to the Research for Future Release milestone Dec 30, 2018
@cryptocode
Copy link
Contributor

There's no inverse lookup table for delegators, so this currently entails looping through the account tables (v0 and v1) and, for each account, reading the rep block to figure out if the block's representative matches the account being queried. Faster lookups are possible, but it seems like it will be at cost of denormalization (a larger ledger)

@kilkelly
Copy link
Author

That was my hunch as well. It wouldn't be worth any ledger size increase just for this command. Looks like some stronger hardware is required on my side. Thanks @cryptocode 👍

@zhyatt zhyatt removed this from the Research for Future Release milestone Dec 31, 2018
@zhyatt
Copy link
Collaborator

zhyatt commented Dec 31, 2018

Closing out due to optimization tradeoffs not worth it.

@zhyatt zhyatt closed this as completed Dec 31, 2018
@meltingice
Copy link

For what it's worth, I'd take a larger ledger in order to speed up this call. It's a feature I like having in NanoCrawler, and the RPC call is painfully slow.

@zhyatt
Copy link
Collaborator

zhyatt commented Jan 9, 2019

Reopening for further discussion of tradeoffs

@zhyatt zhyatt reopened this Jan 9, 2019
@zhyatt zhyatt added this to the Research for Future Release milestone Jan 9, 2019
@meltingice
Copy link

This is perhaps something that would greatly benefit from a customizable database adapter. Could leave the current lmdb implementation as default with the slow delegators call, but allow other database systems (or maybe even a reconfigured lmdb) if desired.

@kilkelly
Copy link
Author

kilkelly commented Jan 9, 2019

Alternatively I wonder if it is possible to have a config.json setting for enabling the denormalisation required to achieve the faster delegators call? A node operator probably wouldn't mind a larger ledger if they were working with that call and delegators_count a lot.

@zhyatt
Copy link
Collaborator

zhyatt commented Jan 9, 2019

@kilkelly Indeed. Making this optional was an approach I was going to discuss with the team. Will get an update on this within the next week or so.

@zhyatt
Copy link
Collaborator

zhyatt commented Jan 28, 2019

It is taking a bit longer than anticipated to dig into this but will be considering for future release.

@kilkelly
Copy link
Author

Is the upcoming "sideband" functionality something that can be utilized for optional, configurable collection of delegator counts or is it just for block info?

BTW I did manage to collect delegator counts for representative addresses I am tracking without using the delegators_count RPC command but it required navigating through the entire ledger with the ledger RPC command.

@cryptocode
Copy link
Contributor

@kilkelly what's the performance of that solution?

@kilkelly
Copy link
Author

kilkelly commented Jan 28, 2019

It varies between 30 minutes to almost 3 hours sometimes. Feels kind of random but that's probably because of regular transaction activity the node is processing also. On a more powerful node it shouldn't take too long.

I navigate through the ledger in chunks of 1000 frontiers at a time.

@cryptocode
Copy link
Contributor

@kilkelly I'm not able to reproduce it taking that long (on master) - 10 seconds at most. Do you have an exact RPC call example?

@kilkelly
Copy link
Author

Hi @cryptocode , it was a normal, vanilla delegators RPC call as outlined in the RPC wiki. I believe the time taken for the call to complete is directly related to the strength of the hardware. I'm currently upgrading my node hardware (8 core, 30 GB) and it takes around 10 - 15 seconds on there. My old, weak node (2 core, 2 GB) was the one giving the extremely slow call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality improvements This item indicates the need for or supplies changes that improve maintainability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants