-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add experimental optimistic provide
This adds the ability to enable "optimistic provide" to the default DHT client, which enables faster provides and reprovides. For more information about optimistic provide, see: https://protocollabs.notion.site/Optimistic-Provide-2c79745820fa45649d48de038516b814 Note that this feature only works when using non-custom router types. This does not include the ability to enable optimistic provide on custom routers for now, to minimize the footprint of this experimental feature. We intend on continuing to test this and improve the UX, which may or may not involve adding configuration for it to custom routers. We also plan on refactoring/redesigning custom routers more broadly so I don't want this to add more effort for maintainers and confusion for users.
- Loading branch information
Showing
10 changed files
with
111 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package config | ||
|
||
type Experiments struct { | ||
FilestoreEnabled bool | ||
UrlstoreEnabled bool | ||
ShardingEnabled bool `json:",omitempty"` // deprecated by autosharding: https://github.com/ipfs/kubo/pull/8527 | ||
GraphsyncEnabled bool | ||
Libp2pStreamMounting bool | ||
P2pHttpProxy bool //nolint | ||
StrategicProviding bool | ||
AcceleratedDHTClient bool | ||
FilestoreEnabled bool | ||
UrlstoreEnabled bool | ||
ShardingEnabled bool `json:",omitempty"` // deprecated by autosharding: https://github.com/ipfs/kubo/pull/8527 | ||
GraphsyncEnabled bool | ||
Libp2pStreamMounting bool | ||
P2pHttpProxy bool //nolint | ||
StrategicProviding bool | ||
AcceleratedDHTClient bool | ||
OptimisticProvide bool | ||
OptimisticProvideJobsPoolSize int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cli | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ipfs/kubo/config" | ||
"github.com/ipfs/kubo/test/cli/harness" | ||
"github.com/ipfs/kubo/test/cli/testutils" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDHTOptimisticProvide(t *testing.T) { | ||
t.Parallel() | ||
|
||
t.Run("optimistic provide smoke test", func(t *testing.T) { | ||
nodes := harness.NewT(t).NewNodes(2).Init() | ||
|
||
nodes[0].UpdateConfig(func(cfg *config.Config) { | ||
cfg.Experimental.OptimisticProvide = true | ||
}) | ||
|
||
nodes.StartDaemons().Connect() | ||
|
||
hash := nodes[0].IPFSAddStr(testutils.RandomStr(100)) | ||
nodes[0].IPFS("dht", "provide", hash) | ||
|
||
res := nodes[1].IPFS("routing", "findprovs", "--num-providers=1", hash) | ||
assert.Equal(t, nodes[0].PeerID().String(), res.Stdout.Trimmed()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters