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

Allow to configure/disable the datastore's ARC cache. #6586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/node/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
func Storage(bcfg *BuildCfg, cfg *config.Config) fx.Option {
cacheOpts := blockstore.DefaultCacheOpts()
cacheOpts.HasBloomFilterSize = cfg.Datastore.BloomFilterSize
cacheOpts.HasARCCacheSize = cfg.Datastore.ARCCacheSize
if !bcfg.Permanent {
cacheOpts.HasBloomFilterSize = 0
}
Expand Down
2 changes: 1 addition & 1 deletion core/node/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead
bs = blockstore.NewBlockstore(rds)
bs = &verifbs.VerifBS{Blockstore: bs}

if !nilRepo {
if !nilRepo && (cacheOpts.HasBloomFilterSize > 0 || cacheOpts.HasARCCacheSize > 0) {
bs, err = blockstore.CachedBlockstore(helpers.LifecycleCtx(mctx, lc), bs, cacheOpts)
if err != nil {
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ As of writing, [7 hash functions](https://github.com/ipfs/go-ipfs-blockstore/blo

Default: `0`

- `ARCCacheSize`
A number representing the number of entries of the blockstore's [ARC cache](https://en.wikipedia.org/wiki/Adaptive_replacement_cache). A value of zero represents the feature being disabled.

Default: `65536`

- `Spec`
Spec defines the structure of the ipfs datastore. It is a composable structure, where each datastore is represented by a json object. Datastores can wrap other datastores to provide extra functionality (eg metrics, logging, or caching).

Expand Down