From b207dc424fb0cbca337e3da79f04c3f111f68924 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 14 Dec 2022 18:20:11 +0300 Subject: [PATCH] [#2158] policer: Reduce default cache size We use cache to avoid policing the same object multiple times in a short time span (< 30 seconds). If we have 200_000 objects in a blobstor, it is a bit useless -- if it takes 1 second to process an object and we have `replicator.pool_size: 20` in config, the next iteration will happen in 10_000 second which is much larger than 30 second. However we still consume a lot of memory, so it makes sense to use saner default. Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 3 ++- pkg/services/policer/policer.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea480413..d38dc4d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ Changelog for NeoFS Node - `neofs-cli container get-eacl` print ACL table in json format only with arg `--json' (#2012) - Side chain notary deposits use max uint32 as till parameter (#1486) - Allow object removal without linking object (#2100) -- `neofs-cli container delete` command pre-checks container ownership (#2106) +- `neofs-cli container delete` command pre-checks container ownership (#2106) +- Policer cache size is now 1024 (#2158) ### Fixed - Open FSTree in sync mode by default (#1992) diff --git a/pkg/services/policer/policer.go b/pkg/services/policer/policer.go index 58e74615b..2245ab792 100644 --- a/pkg/services/policer/policer.go +++ b/pkg/services/policer/policer.go @@ -99,7 +99,7 @@ func defaultCfg() *cfg { return &cfg{ log: &logger.Logger{Logger: zap.L()}, batchSize: 10, - cacheSize: 200_000, // should not allocate more than 200 MiB + cacheSize: 1024, // 1024 * address size = 1024 * 64 = 64 MiB rebalanceFreq: 1 * time.Second, evictDuration: 30 * time.Second, }