-
Notifications
You must be signed in to change notification settings - Fork 1.2k
j s-ipfs runs on the phone but a heavy CPU load, so can it reduce power consumption? #1435
Comments
In ipfs@0.30 you can manage connections with the new connection manager. You pass Options for the connection manager are documented here: https://github.com/libp2p/js-libp2p-connection-manager#create-a-connectionmanager |
Does that answer your question @xuruijing? |
Thank you very much for your reply, I don't know how to use the connectionManager, how to configure the parameters, such as when to call, my goal was to reduce the power consumption of the CPU run time, and don't know how by connectionManager configuration can achieve this goal? In addition, I use ipfsd-ctl to start ipfs. |
Do you have an example of using connectionManager in config? |
Hows this: const IPFS = require('ipfs')
const ipfs = new IPFS({
connectionManager: {
maxPeers: Infinity,
minPeers: 0,
maxData: Infinity,
maxSentData: Infinity,
maxReceivedData: Infinity,
maxEventLoopDelay: Infinity,
pollInterval: 2000,
movingAverageInterval: 60000,
defaultPeerValue: 1
}
}) Info on what the options do is here: https://github.com/libp2p/js-libp2p-connection-manager#create-a-connectionmanager js-ipfs doesn't yet have performance profiles you can pick from so I think it'll be a case of tweaking the parameters until you find something that works for your situation. |
I'm having a hard time finding where Or are we suppose to handle starting and stoping ourselves? Apologies if I'm missing something really obvious 😋 |
I used the latest |
@mistakia the newest version of libp2p (in js-ipfs 0.31) starts the connection manager by default. Sorry about that. @xuruijing you could verify the connection manager is doing it's job by asking the Closing this as I think the original question has now been answered! |
I'm using nodeJs for mobile in a project (react-native), mainly hoping to run IPFS on mobile. I'm experiencing performance issues on the device(iPhone 6+) and simulator, Once the code runs to the ipfs-api, the CPU surges up to 100% and persists. Is it because IPFS has too many connections? Is there a way to limit connections and reduce power consumption?
The text was updated successfully, but these errors were encountered: