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

[config] Add p2p.disc.concurrency flag #3829

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

AlexiaChen
Copy link
Contributor

@AlexiaChen AlexiaChen commented Jul 21, 2021

Issue

Because of the block time problem of all shards, the parameter of concurrency needs to be exposed for adjustment. If it is set to 1, it may currently go wrong and affect the consensus. Set to 1, according to the paper, KAD DHT query time will downgrade to Chord‘s algorithm

图片

NOTE: Add p2p.disc.concurrency flag and default value with libp2p dht

Test

Passed Local test

./harmony --p2p.disc.concurrency 5

@AlexiaChen AlexiaChen self-assigned this Jul 21, 2021
@AlexiaChen AlexiaChen added the libp2p Peer to Peer networking label Jul 21, 2021
@@ -54,6 +54,8 @@ const (
DefaultWSPort = 9800
// DefaultPrometheusPort is the default prometheus port. The actual port used is 9000+900
DefaultPrometheusPort = 9900
// DefaultP2PConcurrency is the default P2P concurrency, 0 means is set the default value of P2P Discovery, the actual value is 10
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the default value from libp2p?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment mentioned, 10 is default

@rlan35
Copy link
Contributor

rlan35 commented Jul 21, 2021

please fix travis test.

@@ -103,6 +103,10 @@ func init() {
confTree.Set("P2P.IP", defaultConfig.P2P.IP)
}

if confTree.Get("P2P.Concurrency") == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a new field, and you need to update the config version. Also it is recommended that you rebase on top of #3773

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to wait the PR you mentioed merged, and I can rebase on the top of the PR. Otherwise this PR may still be changed

@@ -513,6 +513,11 @@ var (
DefValue: defaultConfig.P2P.KeyFile,
Deprecated: "use --p2p.keyfile",
}
p2pDiscoveryConcurrencyFlag = cli.IntFlag{
Name: "p2p.concurrency",
Copy link
Contributor

@JackyWYX JackyWYX Jul 21, 2021

Choose a reason for hiding this comment

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

Suggest p2p.disc.concurrency. p2p.concurrency is too general

@@ -42,6 +42,13 @@ func NewDHTDiscovery(host libp2p_host.Host, opt DHTConfig) (Discovery, error) {
if err != nil {
return nil, err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest move to getLibp2pRawOptions

@AlexiaChen AlexiaChen changed the title [config] Add p2p.concurrency flag [config] Add p2p.disc.concurrency flag Jul 22, 2021
Copy link
Contributor

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

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

please don't do two things in one PR. You may either downgrade or change the default value in the flag. we have no evidence that the libp2p upgrade will cause the issue.

@AlexiaChen AlexiaChen force-pushed the config-concurrency branch from b08947d to 1bf1a53 Compare July 24, 2021 01:02
@AlexiaChen
Copy link
Contributor Author

please don't do two things in one PR. You may either downgrade or change the default value in the flag. we have no evidence that the libp2p upgrade will cause the issue.

Removed downgrade kad-dht code in go.mod, let makes only one change.

@AlexiaChen AlexiaChen force-pushed the config-concurrency branch from 1bf1a53 to 2f8dd26 Compare July 24, 2021 01:06
@rlan35 rlan35 merged commit af7e0de into harmony-one:main Jul 26, 2021
@AlexiaChen AlexiaChen deleted the config-concurrency branch July 27, 2021 02:54
AlexiaChen added a commit to AlexiaChen/harmony that referenced this pull request Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libp2p Peer to Peer networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants