Skip to content

Commit

Permalink
Prefic PQM flag names with "Routing"
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Dec 3, 2024
1 parent c5aa45b commit d0c6c99
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ The following emojis are used to highlight certain changes:
### Added

- Added endpoints to show and purge connected peers [#194](https://github.com/ipfs/rainbow/pull/194)
- Added flags to configure bitswap tuning params:
- `bitswap-max-requests`
- `bitswap-max-providers`
- `bitswap-max-timeout`
- Added flags to configure bitswap/routing tuning params:
- `routing-max-requests`
- `routing-max-providers`
- `routing-max-timeout`

### Changed

Expand Down
44 changes: 23 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,6 @@ Generate an identity seed and launch a gateway:
EnvVars: []string{"BITSWAP_WANTHAVE_REPLACE_SIZE"},
Usage: "Replace WantHave with WantBlock responses for small blocks up to this size, 0 to disable replacement",
},
&cli.IntFlag{
Name: "bitswap-max-requests",
Value: 16,
EnvVars: []string{"BITSWAP_MAX_REQUESTS"},
Usage: "Maximum number of concurrent bitswap find requests, 0 for unlimited",
},
&cli.IntFlag{
Name: "bitswap-max-providers",
EnvVars: []string{"BITSWAP_MAX_PROVIDERS"},
Value: 0,
Usage: "Maximum number of providers to return for each bitswap find request, 0 for unlimited",
},
&cli.DurationFlag{
Name: "bitswap-max-timeout",
Value: 10 * time.Second,
EnvVars: []string{"BITSWAP_MAX_TIMEOUT"},
Usage: "Maximum time for bitswap to find the maximum number of providers",
},
&cli.StringSliceFlag{
Name: "remote-backends",
Value: cli.NewStringSlice(),
Expand Down Expand Up @@ -399,6 +381,24 @@ Generate an identity seed and launch a gateway:
EnvVars: []string{"PEBBLE_WAL_MIN_SYNC_INTERVAL"},
Usage: "Sets the minimum duration between syncs of the WAL",
},
&cli.IntFlag{
Name: "routing-max-requests",
Value: 16,
EnvVars: []string{"ROUTING_MAX_REQUESTS"},
Usage: "Maximum number of concurrent provider find requests, 0 for unlimited",
},
&cli.IntFlag{
Name: "routing-max-providers",
EnvVars: []string{"ROUTING_MAX_PROVIDERS"},
Value: 0,
Usage: "Maximum number of providers to return for each provider find request, 0 for unlimited",
},
&cli.DurationFlag{
Name: "routing-max-timeout",
Value: 10 * time.Second,
EnvVars: []string{"ROUTING_MAX_TIMEOUT"},
Usage: "Maximum time for routing to find the maximum number of providers",
},
}

app.Commands = []*cli.Command{
Expand Down Expand Up @@ -531,9 +531,6 @@ share the same seed as long as the indexes are different.
DHTSharedHost: cctx.Bool("dht-shared-host"),
Bitswap: bitswap,
BitswapWantHaveReplaceSize: cctx.Int("bitswap-wanthave-replace-size"),
BitswapMaxRequests: cctx.Int("bitswap-max-requests"),
BitswapMaxProviders: cctx.Int("bitswap-max-providers"),
BitswapMaxTimeout: cctx.Duration("bitswap-max-timeout"),
IpnsMaxCacheTTL: cctx.Duration("ipns-max-cache-ttl"),
DenylistSubs: cctx.StringSlice("denylists"),
Peering: peeringAddrs,
Expand Down Expand Up @@ -561,6 +558,11 @@ share the same seed as long as the indexes are different.
WALBytesPerSync: cctx.Int("pebble-wal-Bytes-per-sync"),
MaxConcurrentCompactions: cctx.Int("pebble-max-concurrent-compactions"),
WALMinSyncInterval: time.Second * time.Duration(cctx.Int("pebble-wal-min-sync-interval-sec")),

// Routing ProviderQueryManager config
RoutingMaxRequests: cctx.Int("routing-max-requests"),
RoutingMaxProviders: cctx.Int("routing-max-providers"),
RoutingMaxTimeout: cctx.Duration("routing-max-timeout"),
}
var gnd *Node

Expand Down
8 changes: 5 additions & 3 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ type Config struct {
// value. Set to zero to disable replacement and avoid block size lookup
// when processing HaveWant requests.
BitswapWantHaveReplaceSize int
BitswapMaxRequests int
BitswapMaxProviders int
BitswapMaxTimeout time.Duration

DenylistSubs []string

Expand Down Expand Up @@ -153,6 +150,11 @@ type Config struct {
WALBytesPerSync int
MaxConcurrentCompactions int
WALMinSyncInterval time.Duration

// ProviderQueryManager configuration.
RoutingMaxRequests int
RoutingMaxProviders int
RoutingMaxTimeout time.Duration
}

func SetupNoLibp2p(ctx context.Context, cfg Config, dnsCache *cachedDNS) (*Node, error) {
Expand Down
6 changes: 3 additions & 3 deletions setup_bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func setupBitswapExchange(ctx context.Context, cfg Config, h host.Host, cr routi
// 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(cfg.BitswapMaxRequests),
providerquerymanager.WithMaxProviders(cfg.BitswapMaxProviders),
providerquerymanager.WithMaxTimeout(cfg.BitswapMaxTimeout),
providerquerymanager.WithMaxInProcessRequests(cfg.RoutingMaxRequests),
providerquerymanager.WithMaxProviders(cfg.RoutingMaxProviders),
providerquerymanager.WithMaxTimeout(cfg.RoutingMaxTimeout),
)
if err != nil {
panic(err)
Expand Down

0 comments on commit d0c6c99

Please sign in to comment.