From: Vladimír Čunát Date: Mon, 27 Feb 2023 12:23:44 +0000 (+0100) Subject: doc/architecture-gc.rst: describe how GC operates X-Git-Tag: v6.0.1~11^2~1^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63150cae5fb6bd178c0c963730cac29dce582efc;p=thirdparty%2Fknot-resolver.git doc/architecture-gc.rst: describe how GC operates The current code is really simple, so a whole summary fits easily. --- diff --git a/doc/architecture-gc.rst b/doc/architecture-gc.rst index 257a48016..b57c857c3 100644 --- a/doc/architecture-gc.rst +++ b/doc/architecture-gc.rst @@ -1,3 +1,12 @@ ***************** ``kres-cache-gc`` -***************** \ No newline at end of file +***************** + +The garbage collector is a simple component which keeps the shared cache from overfilling. +Every second it estimates cache usage and if over 80%, records get deleted in order to free 10%. (Parameters can be configured.) + +The freeing happens in a few passes. First all items are classified by their estimated usefulness, in a simple way based on remaining TTL, type, etc. +From this histogram it's computed which "level of usefulness" will become the threshold, so that roughly the planned total size gets freed. +Then all items are passed to collect the set of keys to delete, and finally the deletion is performed. +As longer transactions can cause issues in LMDB, all passes are split into short batches. +