Skip to content

Commit 0fe75d6

Browse files
committed
feat: disable resource manager by default (#9003)
* feat: disable resource manager by default We are disabling this by default for v0.13 as we work to improve the UX around Resource Manager. It is still usable and can be enabled in the IPFS config with "ipfs config --bool Swarm.ResourceMgr.Enabled true". We intend to enable Resource Manager by default in a subsequent release. * docs(config): Swarm.ResourceMgr disabled by default Co-authored-by: Marcin Rataj <lidel@lidel.org> (cherry picked from commit b1c051d)
1 parent 87fca8f commit 0fe75d6

File tree

5 files changed

+26
-27
lines changed

5 files changed

+26
-27
lines changed

CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,19 @@ To understand the wider context why we made these changes, read *Highlights* bel
7474

7575
*You can now easily bound how much resource usage libp2p consumes! This aids in protecting nodes from consuming more resources then are available to them.*
7676

77-
The [libp2p Network Resource Manager](https://github.com/libp2p/go-libp2p-resource-manager#readme) is enabled by default, but can be disabled via:
77+
The [libp2p Network Resource Manager](https://github.com/libp2p/go-libp2p-resource-manager#readme) is disabled by default, but can be enabled via:
7878

79-
`ipfs config --json Swarm.ResourceMgr.Enabled false`
79+
`ipfs config --json Swarm.ResourceMgr.Enabled true`
8080

8181
When enabled, it applies some safe defaults that can be inspected and adjusted with:
82+
8283
- `ipfs swarm stats --help`
8384
- `ipfs swarm limit --help`
8485

8586
User changes persist to config at [`Swarm.ResourceMgr`](https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#swarmresourcemgr).
8687

88+
The Resource Manager will be enabled by default in a future release.
89+
8790
#### 🔃 Relay V2 client with auto discovery (`Swarm.RelayClient`)
8891

8992
*All the pieces are enabled for [hole-punching](https://blog.ipfs.io/2022-01-20-libp2p-hole-punching/) by default, improving connecting with nodes behind NATs and Firewalls!*

core/node/libp2p/rcmgr.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func ResourceManager(cfg config.SwarmConfig) interface{} {
3131
var manager network.ResourceManager
3232
var opts Libp2pOpts
3333

34-
enabled := cfg.ResourceMgr.Enabled.WithDefault(true)
34+
enabled := cfg.ResourceMgr.Enabled.WithDefault(false)
3535

3636
/// ENV overrides Config (if present)
3737
switch os.Getenv("LIBP2P_RCMGR") {

docs/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ and tracking recource usage over time.
16371637
Enables the libp2p Network Resource Manager and auguments the default limits
16381638
using user-defined ones in `Swarm.ResourceMgr.Limits` (if present).
16391639

1640-
Default: `true`
1640+
Default: `false`
16411641

16421642
Type: `flag`
16431643

test/sharness/t0116-prometheus-data/prometheus_metrics

-4
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,6 @@ leveldb_datastore_sync_latency_seconds_bucket
656656
leveldb_datastore_sync_latency_seconds_count
657657
leveldb_datastore_sync_latency_seconds_sum
658658
leveldb_datastore_sync_total
659-
libp2p_rcmgr_memory_allocations_allowed_total
660-
libp2p_rcmgr_memory_allocations_blocked_total
661-
libp2p_rcmgr_peer_blocked_total
662-
libp2p_rcmgr_peers_allowed_total
663659
process_cpu_seconds_total
664660
process_max_fds
665661
process_open_fds

test/sharness/t0139-swarm-rcmgr.sh

+19-19
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ test_description="Test ipfs swarm ResourceMgr config and commands"
66

77
test_init_ipfs
88

9+
# test correct behavior when resource manager is disabled (default behavior)
10+
test_launch_ipfs_daemon
11+
12+
test_expect_success 'Swarm limit should fail since RM is disabled' '
13+
test_expect_code 1 ipfs swarm limit system 2> actual &&
14+
test_should_contain "missing ResourceMgr" actual
15+
'
16+
17+
test_expect_success 'Swarm stats should fail since RM is disabled' '
18+
test_expect_code 1 ipfs swarm stats all 2> actual &&
19+
test_should_contain "missing ResourceMgr" actual
20+
'
21+
22+
test_kill_ipfs_daemon
23+
24+
test_expect_success 'Enable resource manager' '
25+
ipfs config --bool Swarm.ResourceMgr.Enabled true
26+
'
27+
928
# swarm limit|stats should fail in offline mode
1029

1130
test_expect_success 'disconnected: swarm limit requires running daemon' '
@@ -127,23 +146,4 @@ test_expect_success 'Set limit for peer scope with an invalid peer ID' '
127146

128147
test_kill_ipfs_daemon
129148

130-
# test correct behavior when resource manager is disabled
131-
test_expect_success 'Disable resource manager' '
132-
ipfs config --bool Swarm.ResourceMgr.Enabled false
133-
'
134-
135-
test_launch_ipfs_daemon
136-
137-
test_expect_success 'Swarm limit should fail since RM is disabled' '
138-
test_expect_code 1 ipfs swarm limit system 2> actual &&
139-
test_should_contain "missing ResourceMgr" actual
140-
'
141-
142-
test_expect_success 'Swarm stats should fail since RM is disabled' '
143-
test_expect_code 1 ipfs swarm stats all 2> actual &&
144-
test_should_contain "missing ResourceMgr" actual
145-
'
146-
147-
test_kill_ipfs_daemon
148-
149149
test_done

0 commit comments

Comments
 (0)