-
-
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
Reduce memory usage #3318
Comments
A nice test for this would be running IPFS on a 512MB VPS. I ran it, using Ubuntu 14.04, running the deamon in the background, and "ipfs get" an 83MB file, the daemon was OOM killed. Testing that the get completes successfully would be nice. I also got this, which I think is already noted as a bug: 15:19:13.466 ERROR flatfs: too many open files, retrying in 600ms flatfs.go:121 |
@mattseh the chart I included above is a VPS with 512 MB running pretty much only ipfs and nginx with no swap. IPFS takes way too much, enabling swap is then sadly required. |
Agreed, I only tried running it on the tiny VPS to see what the simplest thing was that would kill the deamon. |
Node js implementation is separate, please report that on js-ipfs repo. This repo is about go-ipfs implementation. |
I'm seeing 700 MB RAM usage on my VPS instance as well, it would be great if this could be lowered. |
I get OOM killed even on a system with 4 gigs of free memory.
Is there any limitation to how much ipfs uses? How does the ipfs.io gateway stay alive? Do you just restart it every time it dies? |
Our gateways are mostly stable. As a note we are working on connection closing which should solve most of this issue. |
I have exactly the same issue on a VPS of the same size. I have swapping on and that is what is happening. My VPS provider is complaining :) @Kubuxu is there an ETA? I'm happy to help test an early version. |
The only way I have been able to more-or-less stably run ipfs in production was inside a memory-constrained container (systemd cgroup), restarting it everytime it crashed because not having 'enough' memory. This was about half a year ago. Perhaps this should be considered higher priority as some newer features as it does, fundamentally, affect stability and performance of IPFS in a very bad way. |
I agree, this and the overall performance of downloading (which is not
great) are the only things I care about from the IPFS project. Sure,
there are new features that would be nice, but I can implement those
easilly myself by using IPLD, its no show stopper to be missing a new
feature when IPLD is as powerfull as it is. But this IS a bit of a show
stopper.
…On 09/13/2017 09:58 AM, Mathijs de Bruin wrote:
The only way I have been able to more-or-less stably run ipfs in
production was inside a memory-constrained container (systemd cgroup),
restarting it everytime it crashed because not having 'enough' memory.
This was about half a year ago.
Perhaps this should be considered higher priority as some newer
features as it does, fundamentally, affect stability and performance
of IPFS in a very bad way.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3318 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABU7-BbKwMhirxCN8fD1IxgPjd81nG6_ks5sh4s5gaJpZM4KaIx6>.
|
I'd love to see some improvements as well, I'm currently running high memory instances for ipfs. :) My memory usage is around 1G and 2G. |
Hey @dokterbob, we meet again :) |
Don't I get any love, @pors? |
@skorokithakis huh? Scary shit :) |
Hey everyone, we identified and resolved a pretty gnarly memory leak in the dht code. The fix was merged into master here: #4251 If youre having issues with memory usage, please try out latest master (and the soon to be tagged 0.4.11-rc2) and let us know how things go. |
Can we get a build uploaded somewhere, for us plebs? Also, how confident are you that this doesn't contain any show-stopping bugs? We're really really wanting to put a less leaky version to production, but we obviously don't love crashes either :/ |
Yeah, builds will be uploaded once I cut the next release candidate. We are quite confident there are no show-stopping bugs (otherwise we wouldnt have merged it), but to err on the safe side its best to wait for the final release of 0.4.11 |
Once dns finishes propogating, the 0.4.11-rc2 builds will be here: https://dist.ipfs.io/go-ipfs/v0.4.11-rc2 The non-dns url is: https://ipfs.io/ipfs/QmXYxv8gK4SE3n1imq1YAyMGVoUDiCPgaSynMqNQXbAEzm/go-ipfs/v0.4.11-rc2 |
@pors Nice to run into you again! Still would like to have a proper look at hackpad. How may I contact you? IRC or something? @whyrusleeping Thanks for another rc. Let's see how this runs. ^^ |
@dokterbob you can email me at mark at pors dot net. And we can change to Dutch :) |
Can we please keep this on topic? |
I've been running rc2 all day, and memory usage seems much better than before. It's at 16% now whereas it was at 35% before the upgrade, but, given the nature of leaks, we won't know until after a week or so. |
@skorokithakis Thanks! Please let us know if you notice any perf regressions, fixing this properly meant putting a bit more logic in a synchronous hot path and we arent yet sure if it will be an issue in real world scenarios. |
More than 4 GB RAM usage here with 0.4.11, according to top:
SSH session became unresponsive, needed to kill the daemon to get my control back. It should be noted that my node is pinning a few popular JS frameworks, like jQuery and Mathjax. It might be the cause, but I'm not sure. I cannot run the node all the time this way. |
Here is another datapoint. On a machine with 1.7 GB of RAM and 3G of swap, running only IPFS daemon in server mode and nginx, after 4 days we see 1.6 GB of RAM used and 550 MB of swap space used.
Version is docker image |
Can we have a flag to limit the number of peers and some smart logic to discard bad peers and get good ones? That seems to be the unavoidable reason for high memory footprint. |
@klueq Check out the connection manager. https://github.com/ipfs/go-ipfs/blob/419bfdc20fc68d70ba0ea5dc9d0bed8db16c1c11/docs/config.md#connmgr |
Cool. Looks like it's already there. Another suggestion is why not to use UDP? From my limited understanding, all those 800 TCP connections with peers are idle 99% of the time, but they have real memory buffers and other overhead on both sides. Instead, we could send a UDP ping from time to time to check if the peer is online and if we need to transfer some data reliably, we send another UDP message, the peer acks it and we create a temporary TCP channel. |
There is experimental QUIC transport that uses UDP. |
The TCP buffers arent the dominating consumer of memory here. Plus, re-establishing a new connection is very much non-trivial. |
The memory issue comes from our internal buffers/state. We're constantly working on improving this but it'll take time. (semi related: libp2p/go-libp2p#438) |
This is something I've been interested in recently (see #5530) and a reality that we have to contend with is that Go is memory hoggish, and is getting moreso (golang/go#23687). [note: I edited this post a lot as I got closer to the heart of the issue, apologies!] Go is very reluctant to give any memory back to the OS unless the OS very much needs it. I think that something that could be considered for This is an important question because it determines how much work should be done on how Some examples are:
Or, in table form:
|
I'm running IPFS 0.4.17 on my Raspberry PI (using the low power profile if I remember correctly). When it starts it has low memory usage, But that memory usage slowly climbs up as the hours pass. Within 1-2 days the OOM killer usually kills it. The number of connections are low the "ipfs swarm peers" don't fill the terminal window. So I think something is leaking there. Or in the Go runtime. |
@Calmarius Try 0.4.18. There has been significant work towards reducing memory usage. Likely not fully resolved, but should be noticeably better. |
Maybe put a reference to 0.4.18 in the description so we won't have to tell them about it all the time.
(By the way kudo's on the good work, resource usage is indeed much more stable - although not nearly there yet!)
Whyrusleeping <notifications@github.com> schreef op 27 november 2018 18:49:01 GMT+00:00:
…
@Calmarius Try 0.4.18. There has been significant work towards reducing
memory usage. Likely not fully resolved, but should be noticeably
better.
--
Verstuurd vanaf mijn Android apparaat met K-9 Mail. Excuseer mijn beknoptheid.
|
Yes! Updated to 0.4.18 and it's running without problems for 2 weeks on my rpi. Great progress indeed! |
0.4.20, using more than 3GB Ram, problem still |
Under what load, and after running for how long? Does it cap at 3GB for you, or continue to grow? |
I am running about 2 days, but really i still not use too much. Continue growring, now is 3.7GB Ram. Under Ubuntu 18.04 package: go-ipfs. I am on a machine with 9.5 GB Ram, and getting killed processed due to go-ipfs |
I really wonder whats causing this. mars (our first bootstrapper node, and arguably the most connected to ipfs node) peaks at just over 4GB, but every time I check, that much memory is not actually in use, its just the go runtime refusing to return the memory to the OS. @Stebalien can we try running that memory profile dumper thing on some machines? https://gist.github.com/whyrusleeping/b0431561b23a5c1d8b2dfce5526751aa |
Just now was killed the daemon. This makes go-ipfs unusable. Have js-ipfs the same problem? |
@voxsoftware try disabling the DHT by running the daemon with |
I started with --routing=dhtclient. In about 1 hour, now is 850MB memory. I evaluated using ipfs on desktop app, but with this, I see really still unusable for that purpose |
Same here. I'm thinking of having systemd restart the daemon once a day, which is, unfortunately, the last thing I'm going to try before giving up on IPFS altogether... |
I set a memory cap in systemd. The memory pressure keeps it's usage down, and if it still goes over, it gets automatically killed and restarted. Works well enough. |
Can you give an example please? An this works ok for Linux backend, but, how about using in a desktop app for example in Windows? |
Like so: As for Windows, dunno. Haven't used it much in a long time. |
@lordcirth this is extremely helpful, thank you. |
Closing as stale (most of the issues raised here have been addressed, or are recorded in more specific issues). |
As part of our resouce consumption reduction milestore, Lets make an effort to get the idle memory usage of an ipfs node down below 100MB.
Things that could help here are:
READ BEFORE COMMENTING
Please make sure to upgrade to the latest version of go-ipfs before chiming in. Memory usage still needs to be reduced but this gets better every release.
The text was updated successfully, but these errors were encountered: