diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 9f00240c..a95a1a55 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -415,7 +415,6 @@ func initShardOptions(c *cfg) { writecache.WithLogger(c.log), writecache.WithMaxBatchSize(writeCacheCfg.BoltDB().MaxBatchSize()), writecache.WithMaxBatchDelay(writeCacheCfg.BoltDB().MaxBatchDelay()), - writecache.WithMaxMemSize(writeCacheCfg.MemSize()), writecache.WithMaxObjectSize(writeCacheCfg.MaxObjectSize()), writecache.WithSmallObjectSize(writeCacheCfg.SmallObjectSize()), writecache.WithFlushWorkersCount(writeCacheCfg.WorkersNumber()), diff --git a/cmd/neofs-node/config/engine/config_test.go b/cmd/neofs-node/config/engine/config_test.go index 54f7bb24..7eef4eff 100644 --- a/cmd/neofs-node/config/engine/config_test.go +++ b/cmd/neofs-node/config/engine/config_test.go @@ -70,7 +70,6 @@ func TestEngineSection(t *testing.T) { require.Equal(t, false, wc.Enabled()) require.Equal(t, "tmp/0/cache", wc.Path()) - require.EqualValues(t, 2147483648, wc.MemSize()) require.EqualValues(t, 16384, wc.SmallObjectSize()) require.EqualValues(t, 134217728, wc.MaxObjectSize()) require.EqualValues(t, 30, wc.WorkersNumber()) @@ -113,7 +112,6 @@ func TestEngineSection(t *testing.T) { require.Equal(t, true, wc.Enabled()) require.Equal(t, "tmp/1/cache", wc.Path()) - require.EqualValues(t, 2147483648, wc.MemSize()) require.EqualValues(t, 16384, wc.SmallObjectSize()) require.EqualValues(t, 134217728, wc.MaxObjectSize()) require.EqualValues(t, 30, wc.WorkersNumber()) diff --git a/cmd/neofs-node/config/engine/shard/writecache/config.go b/cmd/neofs-node/config/engine/shard/writecache/config.go index 4e45dedb..36be9195 100644 --- a/cmd/neofs-node/config/engine/shard/writecache/config.go +++ b/cmd/neofs-node/config/engine/shard/writecache/config.go @@ -11,9 +11,6 @@ type Config config.Config // config defaults const ( - // MemSizeDefault is a default memory size. - MemSizeDefault = 1 << 30 - // SmallSizeDefault is a default size of small objects. SmallSizeDefault = 32 << 10 @@ -55,22 +52,6 @@ func (x *Config) Path() string { return p } -// MemSize returns the value of "memcache_capacity" config parameter. -// -// Returns MemSizeDefault if the value is not a positive number. -func (x *Config) MemSize() uint64 { - s := config.SizeInBytesSafe( - (*config.Config)(x), - "memcache_capacity", - ) - - if s > 0 { - return s - } - - return MemSizeDefault -} - // SmallObjectSize returns the value of "small_object_size" config parameter. // // Returns SmallSizeDefault if the value is not a positive number. diff --git a/config/example/node.env b/config/example/node.env index bd745c3f..f9351949 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -90,7 +90,6 @@ NEOFS_STORAGE_SHARD_0_MODE=read-only ### Write cache config NEOFS_STORAGE_SHARD_0_WRITECACHE_ENABLED=false NEOFS_STORAGE_SHARD_0_WRITECACHE_PATH=tmp/0/cache -NEOFS_STORAGE_SHARD_0_WRITECACHE_MEMCACHE_CAPACITY=2147483648 NEOFS_STORAGE_SHARD_0_WRITECACHE_SMALL_OBJECT_SIZE=16384 NEOFS_STORAGE_SHARD_0_WRITECACHE_MAX_OBJECT_SIZE=134217728 NEOFS_STORAGE_SHARD_0_WRITECACHE_WORKERS_NUMBER=30 @@ -135,7 +134,6 @@ NEOFS_STORAGE_SHARD_1_MODE=read-write ### Write cache config NEOFS_STORAGE_SHARD_1_WRITECACHE_ENABLED=true NEOFS_STORAGE_SHARD_1_WRITECACHE_PATH=tmp/1/cache -NEOFS_STORAGE_SHARD_1_WRITECACHE_MEMCACHE_CAPACITY=2147483648 NEOFS_STORAGE_SHARD_1_WRITECACHE_SMALL_OBJECT_SIZE=16384 NEOFS_STORAGE_SHARD_1_WRITECACHE_MAX_OBJECT_SIZE=134217728 NEOFS_STORAGE_SHARD_1_WRITECACHE_WORKERS_NUMBER=30 diff --git a/config/example/node.json b/config/example/node.json index 9b5548f0..b53db439 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -135,7 +135,6 @@ "writecache": { "enabled": false, "path": "tmp/0/cache", - "memcache_capacity": 2147483648, "small_object_size": 16384, "max_object_size": 134217728, "workers_number": 30, diff --git a/config/example/node.yaml b/config/example/node.yaml index fe016005..c7b3b1e7 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -113,7 +113,6 @@ storage: writecache: enabled: true - memcache_capacity: 2147483648 # approximate RAM usage limit for "small" objects, bytes small_object_size: 16k # size threshold for "small" objects which are cached in key-value DB, not in FS, bytes max_object_size: 134217728 # size threshold for "big" objects which bypass write-cache and go to the storage directly, bytes workers_number: 30 # number of write-cache flusher threads diff --git a/docs/storage-node-configuration.md b/docs/storage-node-configuration.md index aea08be1..5043ffd6 100644 --- a/docs/storage-node-configuration.md +++ b/docs/storage-node-configuration.md @@ -252,7 +252,6 @@ writecache: enabled: true path: /path/to/writecache capacity: 4294967296 - memcache_capacity: 2147483648 small_object_size: 16384 max_object_size: 134217728 workers_number: 30 @@ -262,7 +261,6 @@ writecache: |----------------------|------------|---------------|----------------------------------------------------------------------------------------------------------------------| | `path` | `string` | | Path to the metabase file. | | `capacity` | `size` | unrestricted | Approximate maximum size of the writecache. If the writecache is full, objects are written to the blobstor directly. | -| `memcache_capacity` | `size` | `1G` | Maximum size of the memory-cache. | | `small_object_size` | `size` | `32K` | Maximum object size for "small" objects. This objects are stored in a key-value database instead of a file-system. | | `max_object_size` | `size` | `64M` | Maximum object size allowed to be stored in the writecache. | | `workers_number` | `int` | `20` | Amount of background workers that move data from the writecache to the blobstor. | diff --git a/pkg/local_object_storage/shard/range_test.go b/pkg/local_object_storage/shard/range_test.go index f9a66172..fd7d324a 100644 --- a/pkg/local_object_storage/shard/range_test.go +++ b/pkg/local_object_storage/shard/range_test.go @@ -65,7 +65,7 @@ func testShardGetRange(t *testing.T, hasWriteCache bool) { } sh := newCustomShard(t, t.TempDir(), hasWriteCache, - []writecache.Option{writecache.WithMaxMemSize(0), writecache.WithMaxObjectSize(writeCacheMaxSize)}, + []writecache.Option{writecache.WithMaxObjectSize(writeCacheMaxSize)}, []blobstor.Option{blobstor.WithStorages([]blobstor.SubStorage{ { Storage: blobovniczatree.NewBlobovniczaTree( diff --git a/pkg/local_object_storage/shard/shard_test.go b/pkg/local_object_storage/shard/shard_test.go index a4c91e49..45c29973 100644 --- a/pkg/local_object_storage/shard/shard_test.go +++ b/pkg/local_object_storage/shard/shard_test.go @@ -35,7 +35,7 @@ func (s epochState) CurrentEpoch() uint64 { func newShard(t testing.TB, enableWriteCache bool) *shard.Shard { return newCustomShard(t, t.TempDir(), enableWriteCache, - []writecache.Option{writecache.WithMaxMemSize(0)}, + nil, nil) } diff --git a/pkg/local_object_storage/writecache/options.go b/pkg/local_object_storage/writecache/options.go index 55020d49..12866023 100644 --- a/pkg/local_object_storage/writecache/options.go +++ b/pkg/local_object_storage/writecache/options.go @@ -19,9 +19,6 @@ type options struct { blobstor *blobstor.BlobStor // metabase is the metabase instance. metabase *meta.DB - // maxMemSize is the maximum total size of all objects cached in memory. - // 1 GiB by default. - maxMemSize uint64 // maxObjectSize is the maximum size of the object stored in the write-cache. maxObjectSize uint64 // smallObjectSize is the maximum size of the object stored in the database. @@ -67,13 +64,6 @@ func WithMetabase(db *meta.DB) Option { } } -// WithMaxMemSize sets maximum size for in-memory DB. -func WithMaxMemSize(sz uint64) Option { - return func(o *options) { - o.maxMemSize = sz - } -} - // WithMaxObjectSize sets maximum object size to be stored in write-cache. func WithMaxObjectSize(sz uint64) Option { return func(o *options) { diff --git a/pkg/local_object_storage/writecache/writecache.go b/pkg/local_object_storage/writecache/writecache.go index a4b4fe2e..c26be5ea 100644 --- a/pkg/local_object_storage/writecache/writecache.go +++ b/pkg/local_object_storage/writecache/writecache.go @@ -66,10 +66,9 @@ type objectInfo struct { } const ( - maxInMemorySizeBytes = 1024 * 1024 * 1024 // 1 GiB - maxObjectSize = 64 * 1024 * 1024 // 64 MiB - smallObjectSize = 32 * 1024 // 32 KiB - maxCacheSizeBytes = 1 << 30 // 1 GiB + maxObjectSize = 64 * 1024 * 1024 // 64 MiB + smallObjectSize = 32 * 1024 // 32 KiB + maxCacheSizeBytes = 1 << 30 // 1 GiB ) var ( @@ -85,7 +84,6 @@ func New(opts ...Option) Cache { compressFlags: make(map[string]struct{}), options: options{ log: zap.NewNop(), - maxMemSize: maxInMemorySizeBytes, maxObjectSize: maxObjectSize, smallObjectSize: smallObjectSize, workersCount: defaultFlushWorkersCount,