@cryptotaxi247 / kubo / commits / 7448340d2

support bitswap configurability (#8268)

* feat: extract Bitswap fx initialization to its own file * chore: bump go-bitswap dependency * feat: bump go-ipfs-config dependency and utilize the new Internal.Bitswap configuration options. Add documentation around the new OptionalInteger config type as well as the Internal.Bitswap options. * docs(docs/config.md): move the table of contents towards the top of the document and update it Co-authored-by: Petar Maymounkov <petarm@gmail.com> Co-authored-by: Marcin Rataj <lidel@lidel.org> Co-authored-by: Gus Eggert <877588+guseggert@users.noreply.github.com>

Adin Schmahmann committed Aug 18, 2021 at 14:15 UTC 7448340d20e0a4e46cfddd8e278f155591dd164a
7 files changed +283 -119
core/node/bitswap.go new
+52
@@ -0,0 +1,52 @@
1 +package node
2 +
3 +import (
4 + "context"
5 +
6 + "github.com/ipfs/go-bitswap"
7 + "github.com/ipfs/go-bitswap/network"
8 + blockstore "github.com/ipfs/go-ipfs-blockstore"
9 + config "github.com/ipfs/go-ipfs-config"
10 + exchange "github.com/ipfs/go-ipfs-exchange-interface"
11 + "github.com/libp2p/go-libp2p-core/host"
12 + "github.com/libp2p/go-libp2p-core/routing"
13 + "go.uber.org/fx"
14 +
15 + "github.com/ipfs/go-ipfs/core/node/helpers"
16 +)
17 +
18 +const (
19 + // Docs: https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#internalbitswap
20 + DefaultEngineBlockstoreWorkerCount = 128
21 + DefaultTaskWorkerCount = 8
22 + DefaultEngineTaskWorkerCount = 8
23 + DefaultMaxOutstandingBytesPerPeer = 1 << 20
24 +)
25 +
26 +// OnlineExchange creates new LibP2P backed block exchange (BitSwap)
27 +func OnlineExchange(cfg *config.Config, provide bool) interface{} {
28 + return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, rt routing.Routing, bs blockstore.GCBlockstore) exchange.Interface {
29 + bitswapNetwork := network.NewFromIpfsHost(host, rt)
30 +
31 + var internalBsCfg config.InternalBitswap
32 + if cfg.Internal.Bitswap != nil {
33 + internalBsCfg = *cfg.Internal.Bitswap
34 + }
35 +
36 + opts := []bitswap.Option{
37 + bitswap.ProvideEnabled(provide),
38 + bitswap.EngineBlockstoreWorkerCount(int(internalBsCfg.EngineBlockstoreWorkerCount.WithDefault(DefaultEngineBlockstoreWorkerCount))),
39 + bitswap.TaskWorkerCount(int(internalBsCfg.TaskWorkerCount.WithDefault(DefaultTaskWorkerCount))),
40 + bitswap.EngineTaskWorkerCount(int(internalBsCfg.EngineTaskWorkerCount.WithDefault(DefaultEngineTaskWorkerCount))),
41 + bitswap.MaxOutstandingBytesPerPeer(int(internalBsCfg.MaxOutstandingBytesPerPeer.WithDefault(DefaultMaxOutstandingBytesPerPeer))),
42 + }
43 + exch := bitswap.New(helpers.LifecycleCtx(mctx, lc), bitswapNetwork, bs, opts...)
44 + lc.Append(fx.Hook{
45 + OnStop: func(ctx context.Context) error {
46 + return exch.Close()
47 + },
48 + })
49 + return exch
50 +
51 + }
52 +}
core/node/core.go
+1 -19
@@ -3,8 +3,7 @@ package node
3 import (
4 "context"
5 "fmt"
6 - "github.com/ipfs/go-bitswap"
7 - "github.com/ipfs/go-bitswap/network"
6 +
7 "github.com/ipfs/go-blockservice"
8 "github.com/ipfs/go-cid"
9 "github.com/ipfs/go-datastore"
@@ -24,8 +23,6 @@ import (
23 "github.com/ipld/go-ipld-prime"
24 basicnode "github.com/ipld/go-ipld-prime/node/basic"
25 "github.com/ipld/go-ipld-prime/schema"
27 - "github.com/libp2p/go-libp2p-core/host"
28 - "github.com/libp2p/go-libp2p-core/routing"
26 "go.uber.org/fx"
27
28 "github.com/ipfs/go-ipfs/core/node/helpers"
@@ -111,21 +108,6 @@ func Dag(bs blockservice.BlockService) format.DAGService {
108 return merkledag.NewDAGService(bs)
109 }
110
114 -// OnlineExchange creates new LibP2P backed block exchange (BitSwap)
115 -func OnlineExchange(provide bool) interface{} {
116 - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, rt routing.Routing, bs blockstore.GCBlockstore) exchange.Interface {
117 - bitswapNetwork := network.NewFromIpfsHost(host, rt)
118 - exch := bitswap.New(helpers.LifecycleCtx(mctx, lc), bitswapNetwork, bs, bitswap.ProvideEnabled(provide))
119 - lc.Append(fx.Hook{
120 - OnStop: func(ctx context.Context) error {
121 - return exch.Close()
122 - },
123 - })
124 - return exch
125 -
126 - }
127 -}
128 -
111 // Files loads persisted MFS root
112 func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, error) {
113 dsk := datastore.NewKey("/local/filesroot")
core/node/groups.go
+1 -1
@@ -262,7 +262,7 @@ func Online(bcfg *BuildCfg, cfg *config.Config) fx.Option {
262 shouldBitswapProvide := !cfg.Experimental.StrategicProviding
263
264 return fx.Options(
265 - fx.Provide(OnlineExchange(shouldBitswapProvide)),
265 + fx.Provide(OnlineExchange(cfg, shouldBitswapProvide)),
266 maybeProvide(Graphsync, cfg.Experimental.GraphsyncEnabled),
267 fx.Provide(DNSResolver),
268 fx.Provide(Namesys(ipnsCacheSize)),
docs/config.md
+205 -93
@@ -5,6 +5,130 @@ is read once at node instantiation, either for an offline command, or when
5 starting the daemon. Commands that execute on a running daemon do not read the
6 config file at runtime.
7
8 +## Table of Contents
9 +
10 +- [The go-ipfs config file](#the-go-ipfs-config-file)
11 + - [Table of Contents](#table-of-contents)
12 + - [Profiles](#profiles)
13 + - [Types](#types)
14 + - [`flag`](#flag)
15 + - [`priority`](#priority)
16 + - [`strings`](#strings)
17 + - [`duration`](#duration)
18 + - [`optionalInteger`](#optionalinteger)
19 + - [`Addresses`](#addresses)
20 + - [`Addresses.API`](#addressesapi)
21 + - [`Addresses.Gateway`](#addressesgateway)
22 + - [`Addresses.Swarm`](#addressesswarm)
23 + - [`Addresses.Announce`](#addressesannounce)
24 + - [`Addresses.NoAnnounce`](#addressesnoannounce)
25 + - [`API`](#api)
26 + - [`API.HTTPHeaders`](#apihttpheaders)
27 + - [`AutoNAT`](#autonat)
28 + - [`AutoNAT.ServiceMode`](#autonatservicemode)
29 + - [`AutoNAT.Throttle`](#autonatthrottle)
30 + - [`AutoNAT.Throttle.GlobalLimit`](#autonatthrottlegloballimit)
31 + - [`AutoNAT.Throttle.PeerLimit`](#autonatthrottlepeerlimit)
32 + - [`AutoNAT.Throttle.Interval`](#autonatthrottleinterval)
33 + - [`Bootstrap`](#bootstrap)
34 + - [`Datastore`](#datastore)
35 + - [`Datastore.StorageMax`](#datastorestoragemax)
36 + - [`Datastore.StorageGCWatermark`](#datastorestoragegcwatermark)
37 + - [`Datastore.GCPeriod`](#datastoregcperiod)
38 + - [`Datastore.HashOnRead`](#datastorehashonread)
39 + - [`Datastore.BloomFilterSize`](#datastorebloomfiltersize)
40 + - [`Datastore.Spec`](#datastorespec)
41 + - [`Discovery`](#discovery)
42 + - [`Discovery.MDNS`](#discoverymdns)
43 + - [`Discovery.MDNS.Enabled`](#discoverymdnsenabled)
44 + - [`Discovery.MDNS.Interval`](#discoverymdnsinterval)
45 + - [`Gateway`](#gateway)
46 + - [`Gateway.NoFetch`](#gatewaynofetch)
47 + - [`Gateway.NoDNSLink`](#gatewaynodnslink)
48 + - [`Gateway.HTTPHeaders`](#gatewayhttpheaders)
49 + - [`Gateway.RootRedirect`](#gatewayrootredirect)
50 + - [`Gateway.Writable`](#gatewaywritable)
51 + - [`Gateway.PathPrefixes`](#gatewaypathprefixes)
52 + - [`Gateway.PublicGateways`](#gatewaypublicgateways)
53 + - [`Gateway.PublicGateways: Paths`](#gatewaypublicgateways-paths)
54 + - [`Gateway.PublicGateways: UseSubdomains`](#gatewaypublicgateways-usesubdomains)
55 + - [`Gateway.PublicGateways: NoDNSLink`](#gatewaypublicgateways-nodnslink)
56 + - [Implicit defaults of `Gateway.PublicGateways`](#implicit-defaults-of-gatewaypublicgateways)
57 + - [`Gateway` recipes](#gateway-recipes)
58 + - [`Identity`](#identity)
59 + - [`Identity.PeerID`](#identitypeerid)
60 + - [`Identity.PrivKey`](#identityprivkey)
61 + - [`Internal`](#internal)
62 + - [`Internal.Bitswap`](#internalbitswap)
63 + - [`Internal.Bitswap.TaskWorkerCount`](#internalbitswaptaskworkercount)
64 + - [`Internal.Bitswap.EngineBlockstoreWorkerCount`](#internalbitswapengineblockstoreworkercount)
65 + - [`Internal.Bitswap.EngineTaskWorkerCount`](#internalbitswapenginetaskworkercount)
66 + - [`Internal.Bitswap.MaxOutstandingBytesPerPeer`](#internalbitswapmaxoutstandingbytesperpeer)
67 + - [`Ipns`](#ipns)
68 + - [`Ipns.RepublishPeriod`](#ipnsrepublishperiod)
69 + - [`Ipns.RecordLifetime`](#ipnsrecordlifetime)
70 + - [`Ipns.ResolveCacheSize`](#ipnsresolvecachesize)
71 + - [`Migration`](#migration)
72 + - [`Migration.DownloadSources`](#migrationdownloadsources)
73 + - [`Migration.Keep`](#migrationkeep)
74 + - [`Mounts`](#mounts)
75 + - [`Mounts.IPFS`](#mountsipfs)
76 + - [`Mounts.IPNS`](#mountsipns)
77 + - [`Mounts.FuseAllowOther`](#mountsfuseallowother)
78 + - [`Pinning`](#pinning)
79 + - [`Pinning.RemoteServices`](#pinningremoteservices)
80 + - [`Pinning.RemoteServices: API`](#pinningremoteservices-api)
81 + - [`Pinning.RemoteServices: API.Endpoint`](#pinningremoteservices-apiendpoint)
82 + - [`Pinning.RemoteServices: API.Key`](#pinningremoteservices-apikey)
83 + - [`Pinning.RemoteServices: Policies`](#pinningremoteservices-policies)
84 + - [`Pinning.RemoteServices: Policies.MFS`](#pinningremoteservices-policiesmfs)
85 + - [`Pinning.RemoteServices: Policies.MFS.Enabled`](#pinningremoteservices-policiesmfsenabled)
86 + - [`Pinning.RemoteServices: Policies.MFS.PinName`](#pinningremoteservices-policiesmfspinname)
87 + - [`Pinning.RemoteServices: Policies.MFS.RepinInterval`](#pinningremoteservices-policiesmfsrepininterval)
88 + - [`Pubsub`](#pubsub)
89 + - [`Pubsub.Router`](#pubsubrouter)
90 + - [`Pubsub.DisableSigning`](#pubsubdisablesigning)
91 + - [`Peering`](#peering)
92 + - [`Peering.Peers`](#peeringpeers)
93 + - [`Reprovider`](#reprovider)
94 + - [`Reprovider.Interval`](#reproviderinterval)
95 + - [`Reprovider.Strategy`](#reproviderstrategy)
96 + - [`Routing`](#routing)
97 + - [`Routing.Type`](#routingtype)
98 + - [`Swarm`](#swarm)
99 + - [`Swarm.AddrFilters`](#swarmaddrfilters)
100 + - [`Swarm.DisableBandwidthMetrics`](#swarmdisablebandwidthmetrics)
101 + - [`Swarm.DisableNatPortMap`](#swarmdisablenatportmap)
102 + - [`Swarm.DisableRelay`](#swarmdisablerelay)
103 + - [`Swarm.EnableRelayHop`](#swarmenablerelayhop)
104 + - [`Swarm.EnableAutoRelay`](#swarmenableautorelay)
105 + - [Mode 1: `EnableRelayHop` is `false`](#mode-1-enablerelayhop-is-false)
106 + - [Mode 2: `EnableRelayHop` is `true`](#mode-2-enablerelayhop-is-true)
107 + - [`Swarm.EnableAutoNATService`](#swarmenableautonatservice)
108 + - [`Swarm.ConnMgr`](#swarmconnmgr)
109 + - [`Swarm.ConnMgr.Type`](#swarmconnmgrtype)
110 + - [Basic Connection Manager](#basic-connection-manager)
111 + - [`Swarm.ConnMgr.LowWater`](#swarmconnmgrlowwater)
112 + - [`Swarm.ConnMgr.HighWater`](#swarmconnmgrhighwater)
113 + - [`Swarm.ConnMgr.GracePeriod`](#swarmconnmgrgraceperiod)
114 + - [`Swarm.Transports`](#swarmtransports)
115 + - [`Swarm.Transports.Network`](#swarmtransportsnetwork)
116 + - [`Swarm.Transports.Network.TCP`](#swarmtransportsnetworktcp)
117 + - [`Swarm.Transports.Network.Websocket`](#swarmtransportsnetworkwebsocket)
118 + - [`Swarm.Transports.Network.QUIC`](#swarmtransportsnetworkquic)
119 + - [`Swarm.Transports.Network.Relay`](#swarmtransportsnetworkrelay)
120 + - [`Swarm.Transports.Security`](#swarmtransportssecurity)
121 + - [`Swarm.Transports.Security.TLS`](#swarmtransportssecuritytls)
122 + - [`Swarm.Transports.Security.SECIO`](#swarmtransportssecuritysecio)
123 + - [`Swarm.Transports.Security.Noise`](#swarmtransportssecuritynoise)
124 + - [`Swarm.Transports.Multiplexers`](#swarmtransportsmultiplexers)
125 + - [`Swarm.Transports.Multiplexers.Yamux`](#swarmtransportsmultiplexersyamux)
126 + - [`Swarm.Transports.Multiplexers.Mplex`](#swarmtransportsmultiplexersmplex)
127 + - [`DNS`](#dns)
128 + - [`DNS.Resolvers`](#dnsresolvers)
129 +
130 +
131 +
132 ## Profiles
133
134 Configuration profiles allow to tweak configuration quickly. Profiles can be
@@ -129,100 +253,13 @@ of strings, or null:
253 Duration is a type for describing lengths of time, using the same format go
254 does (e.g, `"1d2h4m40.01s"`).
255
132 -## Table of Contents
256 +### `optionalInteger`
257
134 -- [`Addresses`](#addresses)
135 - - [`Addresses.API`](#addressesapi)
136 - - [`Addresses.Gateway`](#addressesgateway)
137 - - [`Addresses.Swarm`](#addressesswarm)
138 - - [`Addresses.Announce`](#addressesannounce)
139 - - [`Addresses.NoAnnounce`](#addressesnoannounce)
140 -- [`API`](#api)
141 - - [`API.HTTPHeaders`](#apihttpheaders)
142 -- [`AutoNAT`](#autonat)
143 - - [`AutoNAT.ServiceMode`](#autonatservicemode)
144 - - [`AutoNAT.Throttle`](#autonatthrottle)
145 - - [`AutoNAT.Throttle.GlobalLimit`](#autonatthrottlegloballimit)
146 - - [`AutoNAT.Throttle.PeerLimit`](#autonatthrottlepeerlimit)
147 - - [`AutoNAT.Throttle.Interval`](#autonatthrottleinterval)
148 -- [`Bootstrap`](#bootstrap)
149 -- [`Datastore`](#datastore)
150 - - [`Datastore.StorageMax`](#datastorestoragemax)
151 - - [`Datastore.StorageGCWatermark`](#datastorestoragegcwatermark)
152 - - [`Datastore.GCPeriod`](#datastoregcperiod)
153 - - [`Datastore.HashOnRead`](#datastorehashonread)
154 - - [`Datastore.BloomFilterSize`](#datastorebloomfiltersize)
155 - - [`Datastore.Spec`](#datastorespec)
156 -- [`Discovery`](#discovery)
157 - - [`Discovery.MDNS`](#discoverymdns)
158 - - [`Discovery.MDNS.Enabled`](#discoverymdnsenabled)
159 - - [`Discovery.MDNS.Interval`](#discoverymdnsinterval)
160 -- [`Gateway`](#gateway)
161 - - [`Gateway.NoFetch`](#gatewaynofetch)
162 - - [`Gateway.NoDNSLink`](#gatewaynodnslink)
163 - - [`Gateway.HTTPHeaders`](#gatewayhttpheaders)
164 - - [`Gateway.RootRedirect`](#gatewayrootredirect)
165 - - [`Gateway.Writable`](#gatewaywritable)
166 - - [`Gateway.PathPrefixes`](#gatewaypathprefixes)
167 - - [`Gateway.PublicGateways`](#gatewaypublicgateways)
168 -- [`Identity`](#identity)
169 - - [`Identity.PeerID`](#identitypeerid)
170 - - [`Identity.PrivKey`](#identityprivkey)
171 -- [`Ipns`](#ipns)
172 - - [`Ipns.RepublishPeriod`](#ipnsrepublishperiod)
173 - - [`Ipns.RecordLifetime`](#ipnsrecordlifetime)
174 - - [`Ipns.ResolveCacheSize`](#ipnsresolvecachesize)
175 -- [`Migration`](#migration)
176 - - [`Migration.DownloadSources`](#migrationdownloadsources)
177 - - [`Migration.Keep`](#migrationkeep)
178 -- [`Mounts`](#mounts)
179 - - [`Mounts.IPFS`](#mountsipfs)
180 - - [`Mounts.IPNS`](#mountsipns)
181 - - [`Mounts.FuseAllowOther`](#mountsfuseallowother)
182 -- [`Pinning`](#pinning)
183 - - [`Pinning.RemoteServices`](#pinningremoteservices)
184 - - [`Pinning.RemoteServices.API`](#pinningremoteservices-api)
185 - - [`Pinning.RemoteServices.API.Endpoint`](#pinningremoteservices-apiendpoint)
186 - - [`Pinning.RemoteServices.API.Key`](#pinningremoteservices-apikey)
187 - - [`Pinning.RemoteServices.Policies`](#pinningremoteservices-policies)
188 - - [`Pinning.RemoteServices.Policies.MFS`](#pinningremoteservices-policiesmfs)
189 -- [`Pubsub`](#pubsub)
190 - - [`Pubsub.Router`](#pubsubrouter)
191 - - [`Pubsub.DisableSigning`](#pubsubdisablesigning)
192 -- [`Peering`](#peering)
193 - - [`Peering.Peers`](#peeringpeers)
194 -- [`Reprovider`](#reprovider)
195 - - [`Reprovider.Interval`](#reproviderinterval)
196 - - [`Reprovider.Strategy`](#reproviderstrategy)
197 -- [`Routing`](#routing)
198 - - [`Routing.Type`](#routingtype)
199 -- [`Swarm`](#swarm)
200 - - [`Swarm.AddrFilters`](#swarmaddrfilters)
201 - - [`Swarm.DisableBandwidthMetrics`](#swarmdisablebandwidthmetrics)
202 - - [`Swarm.DisableNatPortMap`](#swarmdisablenatportmap)
203 - - [`Swarm.DisableRelay`](#swarmdisablerelay)
204 - - [`Swarm.EnableRelayHop`](#swarmenablerelayhop)
205 - - [`Swarm.EnableAutoRelay`](#swarmenableautorelay)
206 - - [`Swarm.ConnMgr`](#swarmconnmgr)
207 - - [`Swarm.ConnMgr.Type`](#swarmconnmgrtype)
208 - - [`Swarm.ConnMgr.LowWater`](#swarmconnmgrlowwater)
209 - - [`Swarm.ConnMgr.HighWater`](#swarmconnmgrhighwater)
210 - - [`Swarm.ConnMgr.GracePeriod`](#swarmconnmgrgraceperiod)
211 - - [`Swarm.Transports`](#swarmtransports)
212 - - [`Swarm.Transports.Security`](#swarmtransportssecurity)
213 - - [`Swarm.Transports.Security.TLS`](#swarmtransportssecuritytls)
214 - - [`Swarm.Transports.Security.SECIO`](#swarmtransportssecuritysecio)
215 - - [`Swarm.Transports.Security.Noise`](#swarmtransportssecuritynoise)
216 - - [`Swarm.Transports.Multiplexers`](#swarmtransportsmultiplexers)
217 - - [`Swarm.Transports.Multiplexers.Yamux`](#swarmtransportsmultiplexersyamux)
218 - - [`Swarm.Transports.Multiplexers.Mplex`](#swarmtransportsmultiplexersmplex)
219 - - [`Swarm.Transports.Network`](#swarmtransportsnetwork)
220 - - [`Swarm.Transports.Network.TCP`](#swarmtransportsnetworktcp)
221 - - [`Swarm.Transports.Network.QUIC`](#swarmtransportsnetworkquic)
222 - - [`Swarm.Transports.Network.Websocket`](#swarmtransportsnetworkwebsocket)
223 - - [`Swarm.Transports.Network.Relay`](#swarmtransportsnetworkrelay)
224 -- [`DNS`](#dns)
225 - - [`DNS.Resolvers`](#dnsresolvers)
258 +Optional Integers allow specifying some numerical value which has
259 +an implicit default when `null` or missing from the config file:
260 +
261 +- `null`/missing (apply the default value defined in go-ipfs sources)
262 +- an integer between `-2^63` and `2^63-1` (i.e. `-9223372036854775808` to `9223372036854775807`)
263
264 ## `Addresses`
265
@@ -782,6 +819,81 @@ The base64 encoded protobuf describing (and containing) the node's private key.
819
820 Type: `string` (base64 encoded)
821
822 +## `Internal`
823 +
824 +This section includes internal knobs for various subsystems to allow advanced users with big or private infrastructures to fine-tune some behaviors without the need to recompile go-ipfs.
825 +
826 +**Be aware that making informed change here requires in-depth knowledge and most users should leave these untouched. All knobs listed here are subject to breaking changes between versions.**
827 +
828 +### `Internal.Bitswap`
829 +
830 +`Internal.Bitswap` contains knobs for tuning bitswap resource utilization.
831 +The knobs (below) document how their value should related to each other.
832 +Whether their values should be raised or lowered should be determined
833 +based on the metrics `ipfs_bitswap_active_tasks`, `ipfs_bitswap_pending_tasks`,
834 +`ipfs_bitswap_pending_block_tasks` and `ipfs_bitswap_active_block_tasks`
835 +reported by bitswap.
836 +
837 +These metrics can be accessed as the prometheus endpoint at `{Addresses.API}/debug/metrics/prometheus` (default: `http://127.0.0.1:5001/debug/metrics/prometheus`)
838 +
839 +The value of `ipfs_bitswap_active_tasks` is capped by `EngineTaskWorkerCount`.
840 +
841 +The value of `ipfs_bitswap_pending_tasks` is generally capped by the knobs below,
842 +however its exact maximum value is hard to predict as it depends on task sizes
843 +as well as number of requesting peers. However, as a rule of thumb,
844 +during healthy operation this value should oscillate around a "typical" low value
845 +(without hitting a plateau continuously).
846 +
847 +If `ipfs_bitswap_pending_tasks` is growing while `ipfs_bitswap_active_tasks` is at its maximum then
848 +the node has reached its resource limits and new requests are unable to be processed as quickly as they are coming in.
849 +Raising resource limits (using the knobs below) could help, assuming the hardware can support the new limits.
850 +
851 +The value of `ipfs_bitswap_active_block_tasks` is capped by `EngineBlockstoreWorkerCount`.
852 +
853 +The value of `ipfs_bitswap_pending_block_tasks` is indirectly capped by `ipfs_bitswap_active_tasks`, but can be hard to
854 +predict as it depends on the number of blocks involved in a peer task which can vary.
855 +
856 +If the value of `ipfs_bitswap_pending_block_tasks` is observed to grow,
857 +while `ipfs_bitswap_active_block_tasks` is at its maximum, there is indication that the number of
858 +available block tasks is creating a bottleneck (either due to high-latency block operations,
859 +or due to high number of block operations per bitswap peer task).
860 +In such cases, try increasing the `EngineBlockstoreWorkerCount`.
861 +If this adjustment still does not increase the throuput of the node, there might
862 +be hardware limitations like I/O or CPU.
863 +
864 +#### `Internal.Bitswap.TaskWorkerCount`
865 +
866 +Number of threads (goroutines) sending outgoing messages.
867 +Throttles the number of concurrent send operations.
868 +
869 +Type: `optionalInteger` (thread count, `null` means default which is 8)
870 +
871 +#### `Internal.Bitswap.EngineBlockstoreWorkerCount`
872 +
873 +Number of threads for blockstore operations.
874 +Used to throttle the number of concurrent requests to the block store.
875 +The optimal value can be informed by the metrics `ipfs_bitswap_pending_block_tasks` and `ipfs_bitswap_active_block_tasks`.
876 +This would be a number that depends on your hardware (I/O and CPU).
877 +
878 +Type: `optionalInteger` (thread count, `null` means default which is 128)
879 +
880 +#### `Internal.Bitswap.EngineTaskWorkerCount`
881 +
882 +Number of worker threads used for preparing and packaging responses before they are sent out.
883 +This number should generally be equal to `TaskWorkerCount`.
884 +
885 +Type: `optionalInteger` (thread count, `null` means default which is 8)
886 +
887 +#### `Internal.Bitswap.MaxOutstandingBytesPerPeer`
888 +
889 +Maximum number of bytes (across all tasks) pending to be processed and sent to any individual peer.
890 +This number controls fairness and can very from 250Kb (very fair) to 10Mb (less fair, with more work
891 +dedicated to peers who ask for more). Values below 250Kb could cause thrashing.
892 +Values above 10Mb open the potential for aggressively-wanting peers to consume all resources and
893 +deteriorate the quality provided to less aggressively-wanting peers.
894 +
895 +Type: `optionalInteger` (byte count, `null` means default which is 1MB)
896 +
897 ## `Ipns`
898
899 ### `Ipns.RepublishPeriod`
go.mod
+2 -2
@@ -12,7 +12,7 @@ require (
12 github.com/gabriel-vasile/mimetype v1.1.2
13 github.com/go-bindata/go-bindata/v3 v3.1.3
14 github.com/hashicorp/go-multierror v1.1.1
15 - github.com/ipfs/go-bitswap v0.3.4
15 + github.com/ipfs/go-bitswap v0.4.0
16 github.com/ipfs/go-block-format v0.0.3
17 github.com/ipfs/go-blockservice v0.1.7
18 github.com/ipfs/go-cid v0.0.7
@@ -30,7 +30,7 @@ require (
30 github.com/ipfs/go-ipfs-blockstore v0.1.6
31 github.com/ipfs/go-ipfs-chunker v0.0.5
32 github.com/ipfs/go-ipfs-cmds v0.6.0
33 - github.com/ipfs/go-ipfs-config v0.14.0
33 + github.com/ipfs/go-ipfs-config v0.16.0
34 github.com/ipfs/go-ipfs-exchange-interface v0.0.1
35 github.com/ipfs/go-ipfs-exchange-offline v0.0.1
36 github.com/ipfs/go-ipfs-files v0.0.8
go.sum
+8 -4
@@ -347,8 +347,9 @@ github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSA
347 github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs=
348 github.com/ipfs/go-bitswap v0.1.3/go.mod h1:YEQlFy0kkxops5Vy+OxWdRSEZIoS7I7KDIwoa5Chkps=
349 github.com/ipfs/go-bitswap v0.1.8/go.mod h1:TOWoxllhccevbWFUR2N7B1MTSVVge1s6XSMiCSA4MzM=
350 -github.com/ipfs/go-bitswap v0.3.4 h1:AhJhRrG8xkxh6x87b4wWs+4U4y3DVB3doI8yFNqgQME=
350 github.com/ipfs/go-bitswap v0.3.4/go.mod h1:4T7fvNv/LmOys+21tnLzGKncMeeXUYUd1nUiJ2teMvI=
351 +github.com/ipfs/go-bitswap v0.4.0 h1:bLiqrpef1na4wdqGLqHKv954s1zz6KFghfmQWCPjBik=
352 +github.com/ipfs/go-bitswap v0.4.0/go.mod h1:J2sAsp9UKxLgHDektSy3y3Q9OfQjM9sjhKBR1dlwrMg=
353 github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc=
354 github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
355 github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc=
@@ -420,8 +421,8 @@ github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7Na
421 github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
422 github.com/ipfs/go-ipfs-cmds v0.6.0 h1:yAxdowQZzoFKjcLI08sXVNnqVj3jnABbf9smrPQmBsw=
423 github.com/ipfs/go-ipfs-cmds v0.6.0/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
423 -github.com/ipfs/go-ipfs-config v0.14.0 h1:KijwGU788UycqPWv4GxzyfyN6EtfJjjDRzd/wSA86VU=
424 -github.com/ipfs/go-ipfs-config v0.14.0/go.mod h1:Ei/FLgHGTdPyqCPK0oPCwGTe8VSnsjJjx7HZqUb6Ry0=
424 +github.com/ipfs/go-ipfs-config v0.16.0 h1:CBtIYyp/iWIczCv83bmfge8EA2KqxOOfqmETs3tUnnU=
425 +github.com/ipfs/go-ipfs-config v0.16.0/go.mod h1:wz2lKzOjgJeYJa6zx8W9VT7mz+iSd0laBMqS/9wmX6A=
426 github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
427 github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
428 github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
@@ -506,8 +507,9 @@ github.com/ipfs/go-path v0.1.1/go.mod h1:vC8q4AKOtrjJz2NnllIrmr2ZbGlF5fW2OKKyhV9
507 github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ=
508 github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
509 github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
509 -github.com/ipfs/go-peertaskqueue v0.2.0 h1:2cSr7exUGKYyDeUyQ7P/nHPs9P7Ht/B+ROrpN1EJOjc=
510 github.com/ipfs/go-peertaskqueue v0.2.0/go.mod h1:5/eNrBEbtSKWCG+kQK8K8fGNixoYUnr+P7jivavs9lY=
511 +github.com/ipfs/go-peertaskqueue v0.4.0 h1:x1hFgA4JOUJ3ntPfqLRu6v4k6kKL0p07r3RSg9JNyHI=
512 +github.com/ipfs/go-peertaskqueue v0.4.0/go.mod h1:KL9F49hXJMoXCad8e5anivjN+kWdr+CyGcyh4K6doLc=
513 github.com/ipfs/go-pinning-service-http-client v0.1.0 h1:Au0P4NglL5JfzhNSZHlZ1qra+IcJyO3RWMd9EYCwqSY=
514 github.com/ipfs/go-pinning-service-http-client v0.1.0/go.mod h1:tcCKmlkWWH9JUUkKs8CrOZBanacNc1dmKLfjlyXAMu4=
515 github.com/ipfs/go-unixfs v0.1.0/go.mod h1:lysk5ELhOso8+Fed9U1QTGey2ocsfaZ18h0NCO2Fj9s=
@@ -627,6 +629,7 @@ github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qD
629 github.com/libp2p/go-libp2p v0.12.0/go.mod h1:FpHZrfC1q7nA8jitvdjKBDF31hguaC676g/nT9PgQM0=
630 github.com/libp2p/go-libp2p v0.13.0/go.mod h1:pM0beYdACRfHO1WcJlp65WXyG2A6NqYM+t2DTVAJxMo=
631 github.com/libp2p/go-libp2p v0.14.0/go.mod h1:dsQrWLAoIn+GkHPN/U+yypizkHiB9tnv79Os+kSgQ4Q=
632 +github.com/libp2p/go-libp2p v0.14.3/go.mod h1:d12V4PdKbpL0T1/gsUNN8DfgMuRPDX8bS2QxCZlwRH0=
633 github.com/libp2p/go-libp2p v0.14.4 h1:QCJE+jGyqxWdrSPuS4jByXCzosgaIg4SJTLCRplJ53w=
634 github.com/libp2p/go-libp2p v0.14.4/go.mod h1:EIRU0Of4J5S8rkockZM7eJp2S0UrCyi55m2kJVru3rM=
635 github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052 h1:BM7aaOF7RpmNn9+9g6uTjGJ0cTzWr5j9i9IKeun2M8U=
@@ -876,6 +879,7 @@ github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2
879 github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY=
880 github.com/libp2p/go-tcp-transport v0.2.0/go.mod h1:vX2U0CnWimU4h0SGSEsg++AzvBcroCGYw28kh94oLe0=
881 github.com/libp2p/go-tcp-transport v0.2.1/go.mod h1:zskiJ70MEfWz2MKxvFB/Pv+tPIB1PpPUrHIWQ8aFw7M=
882 +github.com/libp2p/go-tcp-transport v0.2.3/go.mod h1:9dvr03yqrPyYGIEN6Dy5UvdJZjyPFvl1S/igQ5QD1SU=
883 github.com/libp2p/go-tcp-transport v0.2.4 h1:IL5ZAQrkLftufe24mWrmGtTV6drGi6BiXWMTLEM9PBE=
884 github.com/libp2p/go-tcp-transport v0.2.4/go.mod h1:9dvr03yqrPyYGIEN6Dy5UvdJZjyPFvl1S/igQ5QD1SU=
885 github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I=
test/sharness/t0116-prometheus-data/prometheus_metrics
+14
@@ -193,6 +193,10 @@ go_memstats_stack_inuse_bytes
193 go_memstats_stack_sys_bytes
194 go_memstats_sys_bytes
195 go_threads
196 +ipfs_bitswap_active_block_tasks
197 +ipfs_bitswap_active_tasks
198 +ipfs_bitswap_pending_block_tasks
199 +ipfs_bitswap_pending_tasks
200 ipfs_bitswap_recv_all_blocks_bytes_bucket
201 ipfs_bitswap_recv_all_blocks_bytes_bucket
202 ipfs_bitswap_recv_all_blocks_bytes_bucket
@@ -211,6 +215,16 @@ ipfs_bitswap_recv_dup_blocks_bytes_bucket
215 ipfs_bitswap_recv_dup_blocks_bytes_bucket
216 ipfs_bitswap_recv_dup_blocks_bytes_count
217 ipfs_bitswap_recv_dup_blocks_bytes_sum
218 +ipfs_bitswap_send_times_bucket
219 +ipfs_bitswap_send_times_bucket
220 +ipfs_bitswap_send_times_bucket
221 +ipfs_bitswap_send_times_bucket
222 +ipfs_bitswap_send_times_bucket
223 +ipfs_bitswap_send_times_bucket
224 +ipfs_bitswap_send_times_bucket
225 +ipfs_bitswap_send_times_bucket
226 +ipfs_bitswap_send_times_count
227 +ipfs_bitswap_send_times_sum
228 ipfs_bitswap_sent_all_blocks_bytes_bucket
229 ipfs_bitswap_sent_all_blocks_bytes_bucket
230 ipfs_bitswap_sent_all_blocks_bytes_bucket