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

High CPU usage of embedded node #450

Open
samuelmaddock opened this Issue Apr 12, 2018 · 5 comments

Comments

3 participants
@samuelmaddock

samuelmaddock commented Apr 12, 2018

I installed the Chrome extension earlier today and found it to have high CPU usage. I don't think I was using any IPFS-compatible websites besides checking the ipfs.io blog.

macOS: 10.13.2
Chrome: 65.0.3325.181
IPFS Companion: 2.2.0

screen shot 2018-04-12 at 3 31 48 pm

@lidel

This comment has been minimized.

Collaborator

lidel commented Apr 12, 2018

Thank you for reporting this. Was it running against external or embedded node?

@samuelmaddock

This comment has been minimized.

samuelmaddock commented Apr 12, 2018

Thank you for reporting this. Was it running against external or embedded node?

Embedded node

@lidel lidel changed the title from High CPU usage to High CPU usage of embedded node Apr 12, 2018

@lidel lidel added the upstream bug label Apr 13, 2018

@lidel

This comment has been minimized.

Collaborator

lidel commented Apr 13, 2018

Embedded node uses js-ipfs, which is not as mature as go-ipfs. I was able to confirm problem under Chromium: after a few minutes with embedded node the CPU usage is indeed very high.

Let's keep this issue open until upstream issues are resolved:


Workarounds for lowering CPU usage

For the time being I suggest using external node (go-ipfs) which requires smaller amount of resources.
If you run on laptop or other mobile device and want to improve battery life, try additional settings suggested in ipfs/go-ipfs#4137 (comment), namely:

  • you probably want to use ipfs daemon --routing=dhtclient
  • Its probably also worth turning off the reprovider with: ipfs config Reprovider.Interval "0" so your node doesnt rebroadcast all this things it has every 12 hours.

Also related:

@gedw99

This comment has been minimized.

gedw99 commented Apr 18, 2018

Why not just use the new WASM functionality of golang ?
It would keep the J's and golang versions aligned

@lidel

This comment has been minimized.

Collaborator

lidel commented Apr 30, 2018

@gedw99 "just" is bit too optimistic :) We may investigate that route, but my intuition is that it won't be easy. There are low details (such as lack of raw socket API in web browser, storage) that require custom handling etc. Also, there is a huge benefit in having two independent implementations interop in the wild: it verifies if the spec is clear enough.

It may be easier to optimize js-ipfs by introducing WASM (as a technology) in hot paths (eg. crypto), but that is a discussion for https://github.com/ipfs/js-ipfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment