From: Aleš Mrázek Date: Tue, 11 Jul 2023 14:05:38 +0000 (+0200) Subject: docs: config: performance subsection X-Git-Tag: v6.0.2~16^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36af64ea0b4372be7e7c40d8f5277d35eb2da95e;p=thirdparty%2Fknot-resolver.git docs: config: performance subsection --- diff --git a/doc/config-cache-predict.rst b/doc/config-cache-predict.rst new file mode 100644 index 000000000..f25f95bae --- /dev/null +++ b/doc/config-cache-predict.rst @@ -0,0 +1,82 @@ +.. SPDX-License-Identifier: GPL-3.0-or-later + +.. _config-cache-predict: + +Prefetching records +=================== + +Prefetching records helps to keep the cache hot. +It can utilize two independent mechanisms to select the records which should be refreshed: +expiring records and prediction. + +Expiring records +---------------- + +This mechanism is always active when the prefetching is enabled and it is not configurable. + +Any time the resolver answers with records that are about to expire, +they get refreshed. Record is expiring if it has less than 1% TTL (or less than 5s). +That improves latency for records which get frequently queried, relatively to their TTL. + +Prediction +---------- + +The resolver can also learn usage patterns and repetitive queries, +though this mechanism is a prototype and **not recommended** for use in production or with high traffic. + +For example, if it makes a query every day at 18:00, +the resolver expects that it is needed by that time and prefetches it ahead of time. +This is helpful to minimize the perceived latency and keeps the cache hot. + +You can disable prediction by configuring :option:`period >` to ``0``. + +.. tip:: + + The tracking window and period length determine memory requirements. + If you have a server with relatively fast query turnover, keep the period low (hour for start) and shorter tracking window (5 minutes). + For personal slower resolver, keep the tracking window longer (i.e. 30 minutes) and period longer (a day), as the habitual queries occur daily. + Experiment to get the best results. + + +Configuration +------------- + +.. option:: cache/prediction: true|false| + + :default: false + + .. option:: window: