Skip to content

Constant writes of DHT provider records to datastore/*.log #11432

Closed
libp2p/go-libp2p-kad-dht
#1293

Description

@ValdikSS

Checklist

Installation method

dist.ipfs.tech or ipfs-update

Version

Kubo version: 0.43.0
Repo version: 18
System version: amd64/linux
Golang version: go1.26.5-X:nodwarf5

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [
      "/ip4/xxx/tcp/4001",
      "/ip4/xxx/udp/4001/quic-v1",
      "/ip4/xxx/udp/4001/quic-v1/webtransport"
    ],
    "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/127.0.0.0/ipcidr/8",
      "/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/::/ipcidr/3",
      "/ip6/::1/ipcidr/128",
      "/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/webrtc-direct",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/webrtc-direct",
      "/ip6/::/udp/4001/quic-v1",
      "/ip6/::/udp/4001/quic-v1/webtransport",
      "/ip4/0.0.0.0/tcp/4001/tls/sni/*.libp2p.direct/ws",
      "/ip6/::/tcp/4001/tls/sni/*.libp2p.direct/ws"
    ]
  },
  "AutoConf": {},
  "AutoNAT": {},
  "AutoTLS": {},
  "Bitswap": {},
  "Bootstrap": [
    "auto"
  ],
  "DNS": {
    "Resolvers": {
      ".": "auto"
    }
  },
  "Datastore": {
    "BlockKeyCacheSize": null,
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "mountpoint": "/blocks",
          "path": "blocks",
          "prefix": "flatfs.datastore",
          "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
          "sync": false,
          "type": "flatfs"
        },
        {
          "compression": "none",
          "mountpoint": "/",
          "path": "datastore",
          "prefix": "leveldb.datastore",
          "type": "levelds"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "OptimisticProvide": false,
    "OptimisticProvideJobsPoolSize": 0,
    "P2pHttpProxy": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "AllowCodecConversion": null,
    "DeserializedResponses": null,
    "DisableHTMLErrors": null,
    "ExposeRoutingAPI": null,
    "HTTPHeaders": {},
    "NoDNSLink": false,
    "NoFetch": false,
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "HTTPRetrieval": {},
  "Identity": {
    "PeerID": "12D3KooWHpdnMqj7Wo7LWi2cGjHeLbxkoqroDKSybCjgiCCpYder"
  },
  "Import": {
    "BatchMaxNodes": null,
    "BatchMaxSize": null,
    "CidVersion": null,
    "FastProvideDAG": null,
    "FastProvideRoot": null,
    "FastProvideWait": null,
    "HashFunction": null,
    "UnixFSChunker": null,
    "UnixFSDAGLayout": null,
    "UnixFSDirectoryMaxLinks": null,
    "UnixFSFileMaxLinks": null,
    "UnixFSHAMTDirectoryMaxFanout": null,
    "UnixFSHAMTDirectorySizeEstimation": null,
    "UnixFSHAMTDirectorySizeThreshold": null,
    "UnixFSRawLeaves": null
  },
  "Internal": {},
  "Ipns": {
    "DelegatedPublishers": [
      "auto"
    ],
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {},
  "Mounts": {
    "FuseAllowOther": null,
    "IPFS": "/ipfs",
    "IPNS": "/ipns",
    "MFS": "/mfs",
    "StoreMode": null,
    "StoreMtime": null
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provide": {
    "DHT": {}
  },
  "Provider": {},
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "DelegatedRouters": [
      "auto"
    ],
    "Type": "autoclient"
  },
  "Swarm": {
    "AddrFilters": [
      "/ip4/10.0.0.0/ipcidr/8",
      "/ip4/100.64.0.0/ipcidr/10",
      "/ip4/127.0.0.0/ipcidr/8",
      "/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/::/ipcidr/3",
      "/ip6/::1/ipcidr/128",
      "/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": {}
    }
  },
  "Version": {}
}

Description

In the default configuration, Kubo constantly writes datastore/*.log, about 250 KB/second of data.

[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "\354\34\255\r\231\0\1C\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "\v\21\312h\231\0\1D\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "VO\225\354\231\0\1E\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "{G\262q\231\0\1F\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "\265G\24\234\231\0\1G\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "\3\327\263<\231\0\1H\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "\nG\365D\231\0\1I\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "+\256\356^\231\0\1J\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "~\264\245\243\231\0\1K\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160
[pid 2261910] write(587</home/ipfs/.ipfs/datastore/8177060.log>, "TW^\376\231\0\1L\222_\24\1\0\0\0\1\0\0\0\1\200\1/providers"..., 160) = 160

As @lidel said in a forum thread:

IIRC those /providers/... keys are provider records other peers ask your node to store.

I assume your node is publicly reachable, so with the default Routing.Type=auto it switched into DHT Server mode and now accepts a constant stream of ADD_PROVIDER messages from the network. You are co-hosting Amino DHT records.

What strace shows is that stream hitting leveldb’s write-ahead log. Records expire after 48h and are garbage-collected, so it’s churn rather than unbounded growth, but on a HDD it’s noticeable.

If you don’t want that load, run as a DHT client only:

ipfs config Routing.Type autoclient

and restart the daemon. Your node will still fetch and seed files as before; it just stops storing routing records on behalf of other peers.

Kubo wrote 20 GB of data during 3 hours, as could be seen in the forum thread. This is a lot for SSD durability and a lot for HDD performance.

Activity

  1. added
    kind/bug
    need/triage
    on Aug 16, 2026
  2. lidel commented on Aug 17, 2026

    @lidel
    Contributor

    Initial analysis:

    • Every inbound ADD_PROVIDER is a separate unbatched datastore Put (records.ProviderManager.AddProvider in go-libp2p-kad-dht), and default kubo config (ipfs init) points it at the repo leveldb (same that stores pins etc). I guess the ~250 KB/s stream is those puts hitting the WAL; the rest of the 20 GB is compaction rewriting the /providers keyspace, which never settles because records expire after 48h. Batching would trim WAL overhead but not compaction volume.
    • go-libp2p-kad-dht v0.42 already has the hook to fix this: ProviderDatastore gives provider records their own store, and the library default (when no datastore is passed) is an in-memory map, so kubo is the one opting into disk. IPNS and pubkey records stay durable via ValueDatastore.
    • I think losing in-memory records on restart should be fine for the network: ~20 replicas per record, republished within ~22h should self-heal enough, no?
    • In-memory or disk, the missing piece is a size cap. A plain in-memory map is unbounded between GC sweeps and could grow to GBs of RAM within the 48h expiry window at the reported inflow. The built-in provider manager can't be swapped, so iiuc a cap would have to live upstream (e.g. a max-records option wired through ProviderManagerOpts) or as a capped datastore wrapper in kubo.

    @guillaumemichel this feels like something that is not kubo-specific, every DHT server node that persists provider records hits the problem of uncapped provider store. Thoughts on where to handle it? A size-limited in-memory quota for provider records with FIFO-ish eviction in upstream go-libp2p-kad-dht feels right (related: libp2p/go-libp2p-kad-dht#675) but maybe there is more to it / better approach?

  3. added
    need/maintainers-input
    on Aug 17, 2026
  4. guillaumemichel commented on Aug 18, 2026

    @guillaumemichel
    Member

    Thanks @ValdikSS for reporting!

    @lidel remarks are correct, and recommendations should be followed.

    libp2p/go-libp2p-kad-dht#1277 may have introduced a regression in the quantity of fsync triggered by writing provider records to datastore.

    See suggested fix in libp2p/go-libp2p-kad-dht#1293, which is expected to reduce the quantity of fsync and restore the kubo pre-0.43 (kad-dht pre-0.42) provider record persistence batching behavior.

  5. added and removed
    need/triage
    on Aug 19, 2026
  6. lidel commented on Aug 21, 2026

    @lidel
    Contributor

    We will likely have a patch release with fix from libp2p/go-libp2p-kad-dht#1293 in next two weeks (v0.43.1)

  7. reopened this on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugneed/maintainers-inputstatus/in-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions