Garbage collection in IPFS


In the ipfs cluster documenation, it is advised to disable auto-gc if pin_method is set to “refs”.
So does this mean that the Garbage collection never happens at all? Even if the StorageGCWatermark value is exceeded?

1 Like

That’s the default in ipfs but you can always run it manually.

You can enable auto-gc, it just may wipe things which are half-downloaded which will need to be re-fetched. Depending on your usage, this may be just fine.

1 Like

Thanks Hector.

Can you also explain what exactly does “refs” pinning do?

Calling ipfs pin add makes a global lock that allows to only be downloading and pinning 1 thing at a time.

Instead what we call refs pinning, makes ipfs refs -r $hash first. This downloads the content to the local ipfs node first. So the blocking pin add call does not need to download anything and thus, happens much faster. Downloading refs for multiple hashes can happen in parallel, so if you’re adding a big pin, you can still pin other things while the big one is downloading. If you use pin, things would be queued until the big pin is downloaded and pinned.

1 Like