Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Make PearlDiver threads configurable #1017

Merged
merged 1 commit into from
Nov 1, 2018
Merged

Make PearlDiver threads configurable #1017

merged 1 commit into from
Nov 1, 2018

Conversation

CodeMonkeySteve
Copy link
Contributor

Description

Add configuration variable for the number of PoW threads, for manual control.

Fixes #1016

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How Has This Been Tested?

Deployed to production IOTA node, verified specified number of threads were used by CPU load.

Checklist:

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (where?)
  • New and existing unit tests pass locally with my changes

@GalRogozinski
Copy link
Contributor

Hey @CodeMonkeySteve,

Thanks for the PR!
The reason it wasn't merged until now is because it has a conflict. You are using the old configuration design. By looking at the dates I see you probably didn't update your local dev branch since #910
was merged since August 16.

If you decide to do the neccessary changes, please also create a new PearlDiverConfig interface.

1 similar comment
@GalRogozinski
Copy link
Contributor

Hey @CodeMonkeySteve,

Thanks for the PR!
The reason it wasn't merged until now is because it has a conflict. You are using the old configuration design. By looking at the dates I see you probably didn't update your local dev branch since #910
was merged since August 16.

If you decide to do the neccessary changes, please also create a new PearlDiverConfig interface.

@GalRogozinski
Copy link
Contributor

Hey @CodeMonkeySteve,

Thanks for the PR!
The reason it wasn't merged until now is because it has a conflict. You are using the old configuration design. By looking at the dates I see you probably didn't update your local dev branch because #910
was merged since August 16.

If you decide to do the neccessary changes, please also create a new PearlDiverConfig interface.

@iotaledger iotaledger deleted a comment Oct 30, 2018
@iotaledger iotaledger deleted a comment Oct 30, 2018
@iotaledger iotaledger deleted a comment Oct 30, 2018
@CodeMonkeySteve
Copy link
Contributor Author

I added the PearlDiver config, mimicking the other config, but there doesn't seem to be any effect from setting POW_THREADS in the INI file. Am I missing something? Is there something more needed for INI support? Has the format of that file changed?

Any insight would be greatly appreciated (I am not really a Java developer, as you may have noticed).

@iotaledger iotaledger deleted a comment Oct 31, 2018
Copy link
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

Not bad :-)

Do the changes and try the INI file again :-)


@JsonProperty
@Parameter(names = "--pow-threads", description = PearlDiverConfig.Descriptions.POW_THREADS)
protected void setPoWThreads(int powThreads) {
Copy link
Contributor

Choose a reason for hiding this comment

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

change to setPowThreads

Suggested change
protected void setPoWThreads(int powThreads) {
protected void setPowThreads(int powThreads) {

Jackson knows how to translate the name to snake_case. This is why ini wasn't working

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, thanks so much, that fixed it.

src/main/java/com/iota/iri/conf/BaseIotaConfig.java Outdated Show resolved Hide resolved
/**
* Configurations for PearlDiver proof-of-work hasher.
*/
public interface PearlDiverConfig extends Config {
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer PowConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Er, you originally asked for PearlDiverConfig. I think that's more appropriate, as there may be other config fields added later.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

src/main/java/com/iota/iri/conf/PearlDiverConfig.java Outdated Show resolved Hide resolved
src/main/java/com/iota/iri/conf/PearlDiverConfig.java Outdated Show resolved Hide resolved
Copy link
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

Great!

@GalRogozinski GalRogozinski merged commit 51ebe60 into iotaledger:dev Nov 1, 2018
@jakubcech
Copy link
Contributor

Awesome stuff, thank you @CodeMonkeySteve!

@CodeMonkeySteve CodeMonkeySteve deleted the pow_threads branch November 1, 2018 22:02
@CodeMonkeySteve
Copy link
Contributor Author

Happy to help. It's also in my own best interest, as I'm creating >10k transactions per day, so I need to make use of all the CPU cores I have.

@GalRogozinski GalRogozinski mentioned this pull request Dec 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants