-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement bandwidth limiting #3065
Comments
This is critical if you want mass adoption. No one is going to risk their own local Internet connection bandwidth unless they can control it. That means using a 3rd party bandwidth limiter in front of IPFS which is just more complexity that isn't necessary. |
Perhaps using the alternative C by default with low limits, but when putting IPFS on an "active" state switch to A (or to no limit at all). The "active" state should be when the user is actively downloading, adding or pinning something and some time after that, or when he is using IPFS from some management GUI or JS app. |
I was thinking to implement (but never did), a script that alternates, every ~120 seconds between "offline" and "online" mode. It can also read the amount of connections, and restart the client when passes some threshold.
|
Global limiting has my vote. And I'm not sure if this con is true in all cases: bandwidth of course already has a hard limit (the limit of the connection). So if I already have a max of 20mbit down / 2mbit upload, and I limit ipfs to half of this, that is still a decent amount of bandwidth, isn't it? |
I think it would be best to do global limitation and then also limit per protocol relative to the global limit. For example let Maybe i misunderstand the problem though, i just came here because i noticed the high use of bandwidth. 700 peers and 3.5 Mbps, both numbers climbing with no end? I am on win10 and |
@guybrush FYI, you can limit the bandwidth usage by turning off the DHT server on your node by passing the |
This is essential, checking back on this. Without limiting, it's hard for us to package this in projects -> we can't expect end users to accept such a heavy bandwidth requirement. |
Please just add an emoji to the issue itself to add your support. Comments in this thread should be reserved for discussion around the implementation of the feature itself. |
I've been running an IPFS daemon for years without problems. But with the latest builds in the past couple weeks, I have a lot of delays in trying to load web pages or even ssh into another server. It's now at the point where I have to shut down the IPFS daemon to do some tasks. My stats are below. The bandwidth doesn't look so bad, so why does my network suddenly seem clogged? $ for p in /ipfs/bitswap/1.1.0 /ipfs/dht /ipfs/bitswap /ipfs/bitswap/1.0.0 /ipfs/kad/1.0.0 ; do echo ipfs stats bw --proto $p && ipfs stats bw --proto $p && echo "---" ; done
|
@jefft0 thats odd... those stats seem relatively normal. Are you seeing any odd cpu activity? what sort of bandwidth utilization does your OS report from ipfs? Also, how many connections does your node normally have? Another question is, since you mentioned noticing this on recent builds, does running an older version of ipfs fix the problem? |
Also, cc @mgoelzer and @bigs, despite this being on the go-ipfs repo, this is definitely a libp2p issue. Worth getting on the roadmap for sure. |
I solved the problem by restarting my Internet router, restarting the computer, wiping the IPFS build directory and rebuilding the current version (but keeping my current ~/.ipfs folder). I know this wasn't very methodical, but I was desperate. Next time I have bandwidths problems I'll try to figure out which one of these causes the problem. |
@jefft0 interesting. Thats actually more helpful information than you could have provided, thanks |
Also, just so everyone watching this thread is aware, we have implemented a connection manager that limits the total number of connected peers. This can be configured in your ipfs config under |
Definitely a fan of the per-protocol limiting. Perhaps this could be handled with a weighting system? Assign weights to protocols and then set global settings (i.e. throttle after this amt of transfer per duration, halt all transfer after this limit within duration.) |
Very cool to see progress! How's the bandwidth cap (eg: 50kb/s) coming along? It'd be super useful for our desktop client :) |
Are there news about this topic? |
Not at the moment. The current recommended approach is to limit bandwidth in the OS. |
Last time I tried using Trickle with IPFS, it only limited the main thread, and all the other threads that used all the network traffic were unlimited. Is there a flag to get around that? |
@Stebalien cheers! I really want to use and promote IPFS and I sincerely believe this would help. @lordcirth it was over a year ago that I last tried it. Something may have changed in the meantime, but back then IIRC back then Trickle did limit IPFS overall, not just the main thread. |
I also would like to use IPFS in a P2P CDN, but as I'm unable to provide users with bandwidth limitation settings and this issue hasn't really progressed in years I think IPFS isn't a fit (sadly). |
I read all the above comments but I'm still unsure what the final disposition of this issue was? Here's my docker compose definition for IPFS, in case anyone familiar with docker has any input, or suggestions, and also in case it helps others:
I'm shooting for the minimal viable low-bandwidth use case configuration with no swarms, just a single instance of everything. The above config seems to work just fine, but I'm unsure if it's using the least possible bandwidth, or not. |
Enabling the "lowpower" profile should help. That will disable background data reproviding, set really low connection manager limits, and put your node into dhtclient mode. |
regarding to bandwidth limitation, have you considered limiting it externally (OS-level) ? see this idea here: https://discuss.ipfs.io/t/limiting-bandwidth-at-os-level/9102 |
Some people just want to prevent slowing their connection, but others want to avoid hitting their bandwidth caps. So preferably we'd want support for both adaptive and capped bandwidth. It would be better UX to allow configuring bandwidth in IPFS, rather than 3 different sets of instructions for OS firewalls. |
@lordcirth |
Good things are done by design( by professionals like IPFS devs ). IPFS is too awesome and useful to remain just a nice thing that experts/hacker use. Just to mention https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0175360#sec008 may offer some pointers on how to deal with the problems on discovery, query and routing. |
I'm reviving this topic, as it seems to be a show stopper with regard to UX. I captured this bandwidth issue in a YouTube video, showing exactly what the issue is and why it's so detrimental to front end UX: Solutions I've tried:
Seems to me there are two possible solutions:
If anyone else has a proposed solution to this problem, I'm keen to try it. I've also cross-posted this response on this IPFS discussion board thread. |
@christroutner it looks like the issues you are running into are occurring with js-ipfs not go-ipfs. I'll put some thoughts on what you may want to look into with your js-ipfs nodes in the forum post. |
FWIW, I appreciate that greatly. I'm tempted to spin up a vm in the
cloud and just measure it, but I haven't quite gotten to it so far.
To reiterate, I really like IPFS and want it to succeed. I think having
bandwidth limits (like bittorrent clients typically provide) would be a
valuable feature for driving greater adoption.
|
I am bumping this, because on low bandwidth connections like mine, it crashes my home network. And seems like Docker can't do the job. |
The only solution I've found, is to wrap Kubo with Trickle. I created this Docker container which does that. I'm able to set the maximum bandwidth as an environment variable in the docker-compose file. This is less than ideal. It would be a much better user experience if these kinds of bandwidth limits could be set in the IPFS config file. |
Understand that this issue is deffered but I also noticed that /ipfs/id/push/1.0.0 seems to be doing the majority of the egress bandwidth (hand hence cost in my public cloud provider) it doesn't seem that impacted by routingtype or highwater/lowlevel water mark. Here's an example of the first ~12 minutes of running the node.
|
I eventually used resource manager to throttle this down soemwhat aggresively.
But it still seems strange that push protocol would use that much by default. Maybe I should create a different issue to limit just that protocol or optimize it. |
What is the push protocol? |
From what I can see the push protocol is actually mostly libp2p From what I can tell it rebroadcasts node identity to all peers when its protocols or addresses change. This seems like it basically shouldn't be happening ever on my setup so somethings wrong. either addresses aren't stable on kubernetes there's a bug. Need to get debug information on when this broadcast happens. |
Speaking of kubernetes, I think it might have rate-limiting, because I've researched this in the past (although not yet gotten my own project onto K8) and this link from 2019 came up when googling "kubernetes bandwidth limit". I'm currently running "docker swarm" myself, which I don't think can limit bandwidth. Just sharing this info in case it helps. https://stackoverflow.com/questions/54253622/kubernetes-how-to-implement-a-network-resourcequota |
wonder is that here we have an ipfs running in AWS, and suffering from the problem of ipfs using too high Network egress cost, have tried above ResourceMgr connection number limits, but it did not help much, this following is from recent 1 day after restarted ipfs, counting from 0, although wonder is that / # ipfs stats bw --poll -i 5s
Total Up Total Down Rate Up Rate Down
5.5 GB 16 GB 142 kB/s 268 kB/s 👍 on protocol limiting, would be the best
|
@tx0c I did not thought about using stream shaping in Kubo before, we want to add configurable throttling but in our servers such as bitswap or DHT one, not as stream shaping (because the actual data sent on a stream is extremely poorly correlated to the work the server ends up doing, if you only care about transit costs then stream shaping would make sense I guess ?). |
Half a year ago, I did a very rough calculation for the handshake overhead. Seems relevant to share: https://pl-strflt.notion.site/Traffic-Back-Of-The-Envelope-Calculation-7cc525c9eccc4ec18e0a2e2e41b1f6ba |
okay, so the correct term is comparing with BitTorrent client, almost all BitTorrent client app have some kind of in-app bandwidth limiting configuration, and nobody would dare to run BitTorrent unbounded, which would kill all usable bandwidth, when have many files / many ipns keys sharing, the IPFS on desktop is killing almost all bandwidth, on server on AWS means too high network traffic, means Network Cost is very expensive |
Came here after having my home network crash twice. My modem just flatout rebooted - and it's a DrayTec Vygor 164 (or so - its in the 16 line and I keep forgetting the number). As long as IPFS runs, my internet is basically unusable; it's deployed on OpenWrt and sits right behind the modem, with ports on ipv4 and ipv6 open and available. But I can not keep it running if it literally makes everything else - including my own Headscale VPN - unusable. And I am on a 100/20mbit/s link, so this should definitively hold somewhat. Would love to hear about updates to this, thanks! |
The bandwidth consumption of go-ipfs was a constant thorn in my side. I've recently switched to Helia and my bandwidth issues have gone away. If you're looking for a JS implementation, this is the best path to sidestep the bandwidth issues experienced when running ipfs-http-client to control a go-ipfs node. |
I would like to embed Kubo in my App, but unfortunately it doesn't have a bandwidth limit, which would cause my app to take up too much of their bandwidth once it's distributed to the users and lead to complaints. |
We need to place limits on the bandwidth ipfs uses. We can do this a few different ways (or a combination thereof):
Related Issues:
The text was updated successfully, but these errors were encountered: