Solving the Cardano node huge memory usage - done

You can get the specifics in the DiskPolicy that I linked in my previous post.

It boils down to:

  1. On first start, a snapshot is taken as soon as the node sees 2160 (k) “blocksSinceLast”.
    image

This means the number of immutable blocks that had to be applied to get to the chain tip.

  1. After that, if we have made a snapshot already since last node startup it is either:

time since last snapshot (since startup) has been passed (default 72 min) OR if enough blocks have passed since last snapshot (hard-coded 50,000) AND those 50,000 blocks have not passed within 6 minutes (initial sync is happening, don’t snapshot more often than once every 6 minutes).

So, hypothetically: ledger snapshot + immutable DB are in perfect sync on startup, it will take k blocks before a snapshot happens. Or around 12 hours with current settings.

After a first snapshot is made (maximum of about 10 hrs in), it defaults to snapshotting every 72 minutes. If you have decent CPU/memory to replay blocks - it might be worth a try to set SnapshotInterval to 43200. Which would mean it will always take around 12 hrs between snapshots.

Hopefully this clears things up.

2 Likes