forked from TrueCloudLab/frostfs-node
[#472] blobstor: implement write-cache
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
96a8ee7c83
commit
59de521fd1
24 changed files with 1011 additions and 116 deletions
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/metrics"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
|
||||
|
@ -131,6 +132,11 @@ const (
|
|||
|
||||
cfgBlobStorSection = "blobstor"
|
||||
cfgWriteCacheSection = "writecache"
|
||||
cfgWriteCacheMemSize = "mem_size"
|
||||
cfgWriteCacheDBSize = "db_size"
|
||||
cfgWriteCacheSmallSize = "small_size"
|
||||
cfgWriteCacheMaxSize = "max_size"
|
||||
cfgWriteCacheWrkCount = "workers_count"
|
||||
cfgBlobStorCompress = "compress"
|
||||
cfgBlobStorShallowDepth = "shallow_depth"
|
||||
cfgBlobStorTreePath = "path"
|
||||
|
@ -560,6 +566,11 @@ func initShardOptions(c *cfg) {
|
|||
c.log.Warn("incorrect writeCache path, ignore shard")
|
||||
break
|
||||
}
|
||||
writeCacheMemSize := c.viper.GetUint64(configPath(writeCachePrefix, cfgWriteCacheMemSize))
|
||||
writeCacheDBSize := c.viper.GetUint64(configPath(writeCachePrefix, cfgWriteCacheDBSize))
|
||||
writeCacheSmallSize := c.viper.GetUint64(configPath(writeCachePrefix, cfgWriteCacheSmallSize))
|
||||
writeCacheMaxSize := c.viper.GetUint64(configPath(writeCachePrefix, cfgWriteCacheMaxSize))
|
||||
writeCacheWrkCount := c.viper.GetInt(configPath(writeCachePrefix, cfgWriteCacheWrkCount))
|
||||
|
||||
blobPrefix := configPath(prefix, cfgBlobStorSection)
|
||||
|
||||
|
@ -589,6 +600,9 @@ func initShardOptions(c *cfg) {
|
|||
if smallSzLimit == 0 {
|
||||
smallSzLimit = 1 << 20 // 1MB
|
||||
}
|
||||
if writeCacheMaxSize <= 0 {
|
||||
writeCacheSmallSize = smallSzLimit
|
||||
}
|
||||
|
||||
blzPrefix := configPath(blobPrefix, cfgBlobStorBlzSection)
|
||||
|
||||
|
@ -657,9 +671,13 @@ func initShardOptions(c *cfg) {
|
|||
),
|
||||
shard.WithWriteCache(useCache),
|
||||
shard.WithWriteCacheOptions(
|
||||
blobstor.WithRootPath(writeCachePath),
|
||||
blobstor.WithBlobovniczaShallowDepth(0),
|
||||
blobstor.WithBlobovniczaShallowWidth(1),
|
||||
writecache.WithPath(writeCachePath),
|
||||
writecache.WithLogger(c.log),
|
||||
writecache.WithMaxMemSize(writeCacheMemSize),
|
||||
writecache.WithMaxObjectSize(writeCacheMaxSize),
|
||||
writecache.WithSmallObjectSize(writeCacheSmallSize),
|
||||
writecache.WithMaxDBSize(writeCacheDBSize),
|
||||
writecache.WithFlushWorkersCount(writeCacheWrkCount),
|
||||
),
|
||||
shard.WithRemoverBatchSize(rmBatchSize),
|
||||
shard.WithGCRemoverSleepInterval(rmSleepInterval),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue