-
Notifications
You must be signed in to change notification settings - Fork 26
feat: increase routing limits #154
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
Changes from all commits
754e753
2ebfc5b
e6515bf
3abcea1
15c4830
d5b297a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| "context" | ||
| "time" | ||
|
|
||
| "github.com/ipfs/boxo/routing/providerquerymanager" | ||
|
|
||
| "github.com/ipfs/boxo/bitswap" | ||
| bsclient "github.com/ipfs/boxo/bitswap/client" | ||
| bsnet "github.com/ipfs/boxo/bitswap/network" | ||
|
|
@@ -21,7 +23,16 @@ | |
|
|
||
| func setupBitswapExchange(ctx context.Context, cfg Config, h host.Host, cr routing.ContentRouting, bstore blockstore.Blockstore) exchange.Interface { | ||
| bsctx := metri.CtxScope(ctx, "ipfs_bitswap") | ||
| bn := bsnet.NewFromIpfsHost(h, cr) | ||
|
|
||
| bn := bsnet.NewFromIpfsHost(h) | ||
|
|
||
| // Custom query manager with the content router and the host | ||
| // and our custom options to overwrite the default. | ||
| pqm, err := providerquerymanager.New(ctx, h, cr, providerquerymanager.WithMaxInProcessRequests(100)) | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
| pqm.Startup() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless there is a need to start at some later time, or some modes of operation need a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing so prevents problems where calling
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // --- Client Options | ||
| // bitswap.RebroadcastDelay: default is 1 minute to search for a random | ||
|
|
@@ -31,6 +42,14 @@ | |
| // bitswap.ProviderSearchDelay: default is 1 second. | ||
| providerSearchDelay := 1 * time.Second | ||
|
|
||
| // --- Bitswap Client Options | ||
| clientOpts := []bsclient.Option{ | ||
| bsclient.RebroadcastDelay(rebroadcastDelay), | ||
| bsclient.ProviderSearchDelay(providerSearchDelay), | ||
| bsclient.WithoutDuplicatedBlockStats(), | ||
| bsclient.WithDefaultProviderQueryManager(false), // we pass it in manually | ||
| } | ||
|
|
||
| // If peering and shared cache are both enabled, we initialize both a | ||
| // Client and a Server with custom request filter and custom options. | ||
| // client+server is more expensive but necessary when deployment requires | ||
|
|
@@ -48,31 +67,28 @@ | |
| return ok | ||
| } | ||
|
|
||
| // Initialize client+server | ||
| bswap := bitswap.New(bsctx, bn, bstore, | ||
| // --- Client Options | ||
| bitswap.RebroadcastDelay(rebroadcastDelay), | ||
| bitswap.ProviderSearchDelay(providerSearchDelay), | ||
| bitswap.WithoutDuplicatedBlockStats(), | ||
| // turn bitswap clients option into bitswap options | ||
| var opts []bitswap.Option | ||
| for _, o := range clientOpts { | ||
| opts = append(opts, bitswap.WithClientOption(o)) | ||
| } | ||
|
|
||
| // ---- Server Options | ||
| // ---- Server Options | ||
| opts = append(opts, | ||
| bitswap.WithPeerBlockRequestFilter(peerBlockRequestFilter), | ||
| bitswap.ProvideEnabled(false), | ||
| // When we don't have a block, don't reply. This reduces processment. | ||
| bitswap.SetSendDontHaves(false), | ||
| bitswap.WithWantHaveReplaceSize(cfg.BitswapWantHaveReplaceSize), | ||
| ) | ||
|
|
||
| // Initialize client+server | ||
| bswap := bitswap.New(bsctx, bn, pqm, bstore, opts...) | ||
| bn.Start(bswap) | ||
| return &noNotifyExchange{bswap} | ||
| } | ||
|
|
||
| // By default, rainbow runs with bitswap client alone | ||
| bswap := bsclient.New(bsctx, bn, bstore, | ||
| // --- Client Options | ||
| bsclient.RebroadcastDelay(rebroadcastDelay), | ||
| bsclient.ProviderSearchDelay(providerSearchDelay), | ||
| bsclient.WithoutDuplicatedBlockStats(), | ||
| ) | ||
| bswap := bsclient.New(bsctx, bn, pqm, bstore, clientOpts...) | ||
| bn.Start(bswap) | ||
| return bswap | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.