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

Add sleep in batchvote rpc #1810

Merged
merged 7 commits into from
Mar 17, 2023
Merged

Add sleep in batchvote rpc #1810

merged 7 commits into from
Mar 17, 2023

Conversation

prasannavl
Copy link
Member

@prasannavl prasannavl commented Mar 8, 2023

/kind fix

  • Node can become too busy to broadcast during batch voting. This workarounds it by for now by adding an idle period to process messages in between.

  • Wait time is just added as an escape hatch for now since it's meant for limited advanced uses cases and not for widespread adoption.

  • Note: The node also needs to keep catching up on other things like validating incoming blocks, possibly other minor RPCs, etc in between in this time the sleep is added.

Rationale: Ideal targets are institutions that vote on behalf of users, so likely 500 to 3000 votes at a time using the current single threaded wallet logic that's held by global locks.

  • 1s: up to 500s (8m) to 3000s (50m) of additional wait time.
  • 0.5s: up at 250s (4m) to 1500s (25m) of additional wait time.

Considering these nodes might have many addresses per wallet, using a large time factor of 30s - 5m to sign the TX.

  • 30s:
    • 500: ~250m (50m = 20% overhead)
    • 3000: ~1500m (50m = 3% overhead)
  • 5m:
    • 500: ~2500m (2% overhead)
    • 3000: ~15000m (0.3% overhead)

Overhead is high only on low counts, where the consumers are better off using single vote.

Edit: Now using 0.5s as default, since -walletfastselect has much better observed perf. characteristics. This should allows us to turn it as a default and just use a 0.5s for safety for now.

// relay the TXs as it works through. Otherwise, the main
// chain can be locked for too long that prevent broadcasting of
// TXs
std::this_thread::sleep_for(std::chrono::seconds(1));
Copy link
Member

Choose a reason for hiding this comment

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

1 second seems like a long time. Have we tested smaller time periods?

Copy link
Member Author

@prasannavl prasannavl Mar 9, 2023

Choose a reason for hiding this comment

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

Edit: Moved rationale to main thread.

Copy link
Member Author

Choose a reason for hiding this comment

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

Switched to 0.5s in light of the perf. observations data with -walletfastselect

@prasannavl prasannavl added the v/next-release Items ready or targeted for upcoming release(s) label Mar 9, 2023
@prasannavl prasannavl requested a review from Bushstar March 15, 2023 12:58
@dcorral dcorral mentioned this pull request Mar 17, 2023
32 tasks
@Bushstar Bushstar merged commit b86cff2 into master Mar 17, 2023
@Bushstar Bushstar deleted the pvl/sleep-on-batch-vote branch March 17, 2023 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v/next-release Items ready or targeted for upcoming release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants