Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

huge memory and high CPU #2604

Closed
suutaku opened this issue Nov 15, 2019 · 7 comments
Closed

huge memory and high CPU #2604

suutaku opened this issue Nov 15, 2019 · 7 comments
Labels
kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up topic/libp2p Topic libp2p topic/perf Performance

Comments

@suutaku
Copy link

suutaku commented Nov 15, 2019

js-ipfs v 0.38.1
Mac OS X 10.14.6
node 12.10.0

Launch js-ipfs bundle and do nothing.
About 1 hours, memory and cpu usage was going to very hight.
CPU over 130%
memory over 3.5G
process sample:
sample.txt

please take a look. thanks

@suutaku
Copy link
Author

suutaku commented Nov 16, 2019

another cpu profile
Screen Shot 2019-11-16 at 11 24 52 PM

CPU-20191116T231957.cpuprofile.zip

it's really a big problem...

@suutaku suutaku changed the title huge memory and high CPU usage huge memory and high CPU Nov 17, 2019
@suutaku
Copy link
Author

suutaku commented Nov 17, 2019

any update???

@achingbrain
Copy link
Member

Can you share a bit more about your configuration? Some sample code to run that replicates the problem would be best.

@suutaku
Copy link
Author

suutaku commented Nov 19, 2019

Can you share a bit more about your configuration? Some sample code to run that replicates the problem would be best.

here is configuration

{
        silent:true,
        repo: home,
        config: {
            Addresses: {
              Swarm: [
                "/ip4/0.0.0.0/tcp/4001",
                "/ip4/127.0.0.1/tcp/4003/ws",
                "/dns4/xxx/tcp/9090/ws/p2p-webrtc-star"
              ]
            }
          },
        libp2p:  {
            switch: {
              blacklistTTL: 2 * 60 * 1e3, // 2 minute base
              blackListAttempts: 5, // back off 5 times
              maxParallelDials: 100,
              maxColdCalls: 100,
              dialTimeout: 10e3 // Be strict with dial time
            },
            modules: {
              transport: [
                TCP,
                WebSockets,
                webrtcStar,
                wss
                
              ],
              streamMuxer: [
                Multiplex
                //SPDY
              ],
              connEncryption: [
                SECIO
              ],
              connProtector: new Protector(swarmKeyBuffer),
              peerDiscovery: [
                MulticastDNS,
                Bootstrap,
                webrtcStar.discovery,
                wss.discovery
               
              ],
              dht: KadDHT
            },
            config: {
              peerDiscovery: {
                autoDial: true,
                mdns: {
                  enabled: true
                },
                bootstrap: {
                  enabled: true,
                  list: bootstrapers
                },
                websocketStar: {
                  enabled: true
                }
              },
              dht: {
                kBucketSize: 20,
                enabled: true,
                randomWalk: {
                  enabled: true
                }
              },
              relay: { 
                enabled: true, 
                hop: { 
                  enabled: true,
                   active: true 
                } 
              }
            }
        },
        connectionManager: {
          minPeers: 1,
          maxPeers: 50
        }
    }

and I only set up 3 to 4 peers in my private network.

@alanshaw alanshaw added kind/bug A bug in existing code (including security flaws) topic/libp2p Topic libp2p P1 High: Likely tackled by core team if no one steps up topic/perf Performance labels Nov 19, 2019
@alanshaw
Copy link
Member

cc @jacobheun @vasco-santos

@jacobheun
Copy link
Contributor

@suutaku you have 3 or 4 nodes in a private network, are they all sharing the same config you provided above? Are these all running on Node.js or do you also have browser/go nodes?

There are existing performance issues we are aware of with the DHT which is why we don't currently recommend running it with ipfs at the moment, but 4 nodes really shouldn't be a problem.

@suutaku
Copy link
Author

suutaku commented Nov 28, 2019

Yes, nodes sharing same config.
3 go version nodes running with cluster-server-ctl, without /wssupported.
1 node running js-ipfs bundle.
After did same reaches. I removed package libp2p-kad-dht@0.16.0 and install libp2p-kad-dht@0.16.1, memory keeping on 100M for now. I will do more testing to make sure if 0.16.1 is ok.
from @alanshaw 's relay at #2311 , I know you are doing a big refactor now. it will be awesome if the performance problem fixed.

@suutaku suutaku closed this as completed Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up topic/libp2p Topic libp2p topic/perf Performance
Projects
None yet
Development

No branches or pull requests

4 participants