frostfs-node/pkg/local_object_storage/writecache
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
..
delete.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
doc.go [#472] blobstor: implement write-cache 2021-04-29 17:36:36 +03:00
flush.go [#568] shard/writecache: Maintain memory size and db size 2021-06-21 14:26:30 +03:00
get.go [#762] write-cache: Implement Head operation 2021-09-02 11:33:17 +03:00
options.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
persist.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
put.go [#790] writecache: Log each writing operation 2021-09-13 15:02:13 +03:00
state.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
storage.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00
writecache.go [#776] writecache: Limit size of used disk space 2021-09-15 18:07:36 +03:00