Skip to content
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

feat: persist limits to Swarm.ResourceMgr.Limits #8901

Merged
merged 3 commits into from
Apr 28, 2022
Merged

Conversation

guseggert
Copy link
Contributor

@guseggert guseggert commented Apr 21, 2022

Part of #8761, follow-up after #8680

This changes the "ipfs swarm limit" command so that When limit changes
are applied via the command line, they are persisted to the repo
config, so that they remain in effect when the daemon restarts.

This also removes limit.json support, to simplify the behavior. The
schema for Swarm.ResourceMgr.Limits is exactly the same as limit.json,
so existing limit.json can be dropped into the IPFS config easily
using something like:

$ cat ~/.ipfs/config | jq ".Swarm.ResourceMgr.Limits = $(cat limit.json)" | sponge ~/.ipfs/config

This upgrades to Resource Manager v0.3.0, which exports the config
schema so that we don't have to maintain our own copy of it.

@guseggert guseggert requested a review from lidel April 21, 2022 19:42
@guseggert guseggert marked this pull request as ready for review April 21, 2022 19:43
@guseggert guseggert added this to the go-ipfs 0.13 milestone Apr 21, 2022
@guseggert guseggert mentioned this pull request Apr 21, 2022
4 tasks
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @guseggert ! Did a quick pass:

Good:

  • removing limit.json – 👍
  • swarm limit always persisting to Swarm.ResourceMgr.Limits – 👍

Needs fixing:

  • helptext in swarm limit --help needs updating to reflect that we now always persist
  • Enabling resource manager via one-liner ipfs config --json Swarm.ResourceMgr.Enabled true needs to work (right now it is not enough, panics due to missing Limits – see comment for core/node/libp2p/rcmgr.go)
  • + smaller comments inline

config/swarm.go Show resolved Hide resolved
core/node/libp2p/rcmgr.go Outdated Show resolved Hide resolved
core/node/libp2p/rcmgr.go Outdated Show resolved Hide resolved
core/node/libp2p/rcmgr.go Outdated Show resolved Hide resolved
test/sharness/t0139-swarm-rcmgr.sh Outdated Show resolved Hide resolved
test/sharness/t0139-swarm-rcmgr.sh Show resolved Hide resolved
@BigLep BigLep linked an issue Apr 26, 2022 that may be closed by this pull request
4 tasks
This changes the "ipfs swarm limit" command so that When limit changes
are applied via the command line, they are persisted to the repo
config, so that they remain in effect when the daemon restarts.

This also removes limit.json support, to simplify the behavior. The
schema for Swarm.ResourceMgr.Limits is exactly the same as limit.json,
so existing limit.json can be dropped into the IPFS config easily
using something like:

cat ~/.ipfs/config | jq ".Swarm.ResourceMgr.Limits = $(cat limit.json)" | sponge ~/.ipfs/config

This upgrades to Resource Manager v0.3.0, which exports the config
schema so that we don't have to maintain our own copy of it.
Makes sure we evaluate the config JSON directly, so we catch any
regressions around serialization too.
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great, thank you, @guseggert 🙌

I noticed that we have no easy way to restore the implicit default once we set a custom one, but willed a separate issue for solving that: #8918 (this is nice-to-have, so could be tackled in future RCs, or pushed till 0.14)

I'm merging this one 🚀

@lidel lidel merged commit 74aff24 into master Apr 28, 2022
@lidel lidel deleted the feat/rcmgr-config branch April 28, 2022 13:27
@lidel lidel changed the title feat: persist limit changes to config feat: persist limits to Swarm.ResourceMgr.Limits (#8901) Apr 28, 2022
@lidel lidel changed the title feat: persist limits to Swarm.ResourceMgr.Limits (#8901) feat: persist limits to Swarm.ResourceMgr.Limits Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ResourceMgr UX improvements
2 participants