Skip to content
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

Kubo 0.20.0-dev is eating all my CPU. #9705

Closed
3 tasks done
jvoisin opened this issue Mar 8, 2023 · 9 comments
Closed
3 tasks done

Kubo 0.20.0-dev is eating all my CPU. #9705

jvoisin opened this issue Mar 8, 2023 · 9 comments
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@jvoisin
Copy link

jvoisin commented Mar 8, 2023

Checklist

Installation method

built from source

Version

Kubo version: 0.20.0-dev-40d7f2fec
Repo version: 13
System version: amd64/linux
Golang version: go1.20.2

Config

{
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Methods": [
        "PUT",
        "POST"
      ],
      "Access-Control-Allow-Origin": [
        "http://localhost:3000",
        "http://127.0.0.1:5001",
        "https://webui.ipfs.io"
      ]
    }
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [
      "/ip4/10.0.0.0/ipcidr/8",
      "/ip4/100.64.0.0/ipcidr/10",
      "/ip4/169.254.0.0/ipcidr/16",
      "/ip4/172.16.0.0/ipcidr/12",
      "/ip4/192.0.0.0/ipcidr/24",
      "/ip4/192.0.2.0/ipcidr/24",
      "/ip4/192.168.0.0/ipcidr/16",
      "/ip4/198.18.0.0/ipcidr/15",
      "/ip4/198.51.100.0/ipcidr/24",
      "/ip4/203.0.113.0/ipcidr/24",
      "/ip4/240.0.0.0/ipcidr/4",
      "/ip6/100::/ipcidr/64",
      "/ip6/2001:2::/ipcidr/48",
      "/ip6/2001:db8::/ipcidr/32",
      "/ip6/fc00::/ipcidr/7",
      "/ip6/fe80::/ipcidr/10"
    ],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/quic",
      "/ip6/::/udp/4001/quic-v1",
      "/ip6/::/udp/4001/quic-v1/webtransport"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false
    }
  },
  "Experimental": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": true,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "Identity": {
    "PeerID": "12D3KooWLpm2byv3yD5gys2VHou3bBrDVuwYFYpbSEuisgxpYoHG"
  },
  "Internal": {},
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": [
      {
        "Addrs": [
          "/dnsaddr/node-1.ingress.cloudflare-ipfs.com"
        ],
        "ID": "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE"
      }
    ]
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": [
      "/ip4/10.0.0.0/ipcidr/8",
      "/ip4/100.64.0.0/ipcidr/10",
      "/ip4/169.254.0.0/ipcidr/16",
      "/ip4/172.16.0.0/ipcidr/12",
      "/ip4/192.0.0.0/ipcidr/24",
      "/ip4/192.0.2.0/ipcidr/24",
      "/ip4/192.168.0.0/ipcidr/16",
      "/ip4/198.18.0.0/ipcidr/15",
      "/ip4/198.51.100.0/ipcidr/24",
      "/ip4/203.0.113.0/ipcidr/24",
      "/ip4/240.0.0.0/ipcidr/4",
      "/ip6/100::/ipcidr/64",
      "/ip6/2001:2::/ipcidr/48",
      "/ip6/2001:db8::/ipcidr/32",
      "/ip6/fc00::/ipcidr/7",
      "/ip6/fe80::/ipcidr/10"
    ],
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": true,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

I'm running the latest git kubo and it's eating a ton of CPU (profile), I don't think this is working as intended, since my node is apparently not doing much if anything at all

~ $ /home/ipfs/kubo/cmd/ipfs/ipfs swarm peers | wc -l
25
~  $ /home/ipfs/kubo/cmd/ipfs/ipfs stats bw
Bandwidth
TotalIn: 25 MB
TotalOut: 8.4 MB
RateIn: 354 B/s
RateOut: 5.8 kB/s
~ $ 
@jvoisin jvoisin added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Mar 8, 2023
@Jorropo
Copy link
Contributor

Jorropo commented Mar 8, 2023

@jvoisin something is putting a huge load on the scheduler that indeed does look like a bug. On the actual usage even tho it's sad 188% cpu usage aint that much. We certainly want to improve this but not wildly out of the ordinary.

How many cores do you have ?

@jvoisin
Copy link
Author

jvoisin commented Mar 8, 2023

It's running on a AMD Ryzen 7 5700G with 16 cores and 4G of RAM.

For reference, Kubo is eating twice as much CPU than a fishtest runner, and 4 times a 10MiB/s tor node .

@celeduc
Copy link

celeduc commented Mar 27, 2023

v0.18.1 used to take around 5% CPU on average, across 4 cores. v0.19.0 takes 48-51% on average. It's not doing much either, on either of my nodes ~20-50kB/s up/down.

Ubuntu 22.04.2 LTS, Intel® Core™ i7-7500U CPU @ 2.70GHz × 4, 16GB
and
Ubuntu 22.04.2 LTS, Intel® Core™ i5-6600 CPU @ 3.30GHz × 4, 20GB

@Jorropo
Copy link
Contributor

Jorropo commented Mar 27, 2023

Btw we know of a bug in the latest libp2p release where it waste lots of CPU.

I have no idea what versions you are talking about tho because v0.20.0 does not exists and v0.19.1 will be released this week (with this fix), the current latest release is v0.19.0.
I would love to know where you got your time travel machine. :D

I would like you to test once v0.19.1 is released please.

@celeduc
Copy link

celeduc commented Mar 27, 2023

I would love to know where you got your time travel machine. :D

Classic developer off-by-one error :)

@celeduc
Copy link

celeduc commented Mar 29, 2023

Tested master @ 3ab1086 and this bug is gone, CPU usage back to normal. I'd consider it fixed for v0.19.1.

@jvoisin
Copy link
Author

jvoisin commented Mar 29, 2023

I can confirm that the issue is gone :)

@Jorropo
Copy link
Contributor

Jorropo commented Mar 29, 2023

We discovered an other busyloop which is only using resources while downloading data using Blockservice().GetBlocks this gonna be fixed in v0.19.1 too. This affects CPU usage when using ipfs get for example.
ipfs/boxo#232

@Jorropo
Copy link
Contributor

Jorropo commented Apr 19, 2023

The profile you sent 404 for me, so I can't check if it is the exact one we fixed.
Many peoples reporting it's fixed, two of thoses have been fixed in v0.19.1 🎉

If this is still an issue please reopen this issue.

@Jorropo Jorropo closed this as completed Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

3 participants