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

Ability to limit CPU rate for POW #1734

Merged
merged 9 commits into from Mar 26, 2019

Conversation

@wezrule
Copy link
Collaborator

commented Feb 16, 2019

After a transaction some CPUs works overtime trying to pre-cache the next POW. It may not be necessary for them to pre-cache as soon as possible, for example if transactions are made infrequently. This add the ability to do a thread sleep in the work threads using an amount of nanoseconds specified in the new config option pow_sleep_interval (default is 0). Add the same string as a CLI sub-option to --debug_profile_generate to be able to test the timings there.

Rate limited POW
Formatting

Fix wallet build

Formatting

Fix test

Change interval to nanoseconds

Formatting

@wezrule wezrule self-assigned this Feb 16, 2019

@zhyatt zhyatt added this to the V19.0 milestone Feb 16, 2019

@zhyatt zhyatt requested a review from clemahieu Feb 16, 2019

@wezrule wezrule added this to CP1 in V19 Feb 19, 2019

wezrule added some commits Feb 26, 2019

@wezrule

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 26, 2019

@guilhermelawless your comment seems to have been removed during the merges 🐙. There is an existing CLI option --debug_profile_generate which should time how long work takes.

@guilhermelawless

This comment has been minimized.

Copy link
Contributor

commented Feb 26, 2019

Huh, strange. Thank you that will be useful, and this PR especially is great for Distributed PoW clients. I hope you don't mind I take the idea and implement in that one and nano-work-server

@wezrule

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 26, 2019

Although looking at --debug_profile_generate it doesn't take into account the config file, so I will add a sub-option to the CLI to specify the sleep amount so that users can test it to find a suitable value. Thanks for point that out!

@wezrule wezrule added the tool label Feb 26, 2019

@clemahieu
Copy link
Collaborator

left a comment

Looks good otherwise

Show resolved Hide resolved nano/lib/work.cpp

wezrule added some commits Mar 26, 2019

@wezrule wezrule merged commit 878cce9 into nanocurrency:master Mar 26, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@wezrule wezrule deleted the wezrule:eco_pow_generation branch Mar 26, 2019

@zhyatt zhyatt added the documentation label Apr 1, 2019

guilhermelawless added a commit to guilhermelawless/nano-node that referenced this pull request Apr 15, 2019

Ability to limit CPU rate for POW (nanocurrency#1734)
* Rate limited POW

Formatting

Fix wallet build

Formatting

Fix test

Change interval to nanoseconds

Formatting

* Formatting

* Formatting again

* Add CLI option to --debug_profile_generate to specify sleep interval.

* Move thread sleep to outer while loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.