frostfs-node/pkg
Leonard Lyubich a1696a81b6 [#776] writecache: Limit size of used disk space
There is a need to limit disk space used by write-cache. It is almost
impossible to calculate the value exactly. It is proposed to estimate the
size of the cache by the number of objects stored in it.

Track amounts of objects saved in DB and FSTree separately. To do this,
`ObjectCounters` interface is defined. It is generalized to a store of
numbers that can be made persistent (new option `WithObjectCounters`). By
default DB number is calculated as key number in default bucket, and FS
number is set same to DB since it is currently hard to read the actual value
from `FSTree` instance. Each PUT/DELETE operation to DB or FS
increases/decreases corresponding counter. Before each PUT op an overflow
check is performed with the following formula for evaluating the occupied
space: `NumDB * MaxDBSize + NumFS * MaxFSSize`. If next PUT can cause
write-cache overflow, object is written to the main storage.

By default maximum write-cache size is set to 1GB.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-15 18:07:36 +03:00
..
core [#645] core: Define interface of the tool for working with netmap keys 2021-09-07 09:53:18 +03:00
innerring [#786] pkg/innerring: Use NNS to find contract script hashes missing in config 2021-09-13 14:51:35 +03:00
local_object_storage [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
metrics [#426] Put prometheus behind pkg/metrics 2021-03-17 10:58:00 +03:00
morph [#786] morph/client: Add NNS contract address getter 2021-09-13 14:51:35 +03:00
network [#645] network: Remove no longer used IsLocalAddress function 2021-09-07 09:53:18 +03:00
services [#811] service/container: Hide cache invalidation logic in Writer interface 2021-09-13 14:50:18 +03:00
util [#798] util/state: Implement persistent storage for application state 2021-09-07 17:22:25 +03:00