]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules: predict: prefetching expired records has been removed
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 17 Apr 2024 13:41:52 +0000 (15:41 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Mon, 22 Apr 2024 10:43:52 +0000 (12:43 +0200)
modules/predict/README.rst
modules/predict/predict.lua

index 966c4ca4e1d73fd8aa2a04f44dc09b04a1781d6d..0bc856717259e14f839656872eab55ed36ca25f6 100644 (file)
@@ -2,34 +2,19 @@
 
 .. _mod-predict:
 
-Prefetching records
-===================
-
-The ``predict`` module helps to keep the cache hot by prefetching records.
-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 predict module is loaded and it is not configurable.
-
-Any time the resolver answers with records that are about to expire,
-they get refreshed. (see :c:func:`is_expiring`)
-That improves latency for records which get frequently queried, relatively to their TTL.
-
 Prediction
 ----------
 
-The predict module can also learn usage patterns and repetitive queries,
+``predict`` is an experimental module that tries to help keep the cache hot by prefetching records using a prediction mechanism to select records which should be refreshed.
+
+The module can 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 ``period = 0``.
-Otherwise it will load the required :ref:`stats <mod-stats>` module if not present,
+It will load the required :ref:`stats <mod-stats>` module if not present,
 and it will use its :func:`stats.frequent` table and clear it periodically.
 
 .. 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.
index 0117fd521bc755213f12653d1cf1135f87b80255..38fb7258a404b5a2ffaa4fc5249dcaa9ffbc1f6a 100644 (file)
@@ -172,18 +172,4 @@ function predict.config(config)
        predict.init()
 end
 
-predict.layer = {
-       -- Prefetch all expiring (sub-)queries immediately after the request finishes.
-       -- Doing that immediately is simplest and avoids creating (new) large bursts of activity.
-       finish = function (_, req)
-               local qrys = req.rplan.resolved
-               for i = 0, (tonumber(qrys.len) - 1) do -- size_t doesn't work for some reason
-                       local qry = qrys.at[i]
-                       if qry.flags.EXPIRING == true then
-                               resolve(kres.dname2str(qry.sname), qry.stype, qry.sclass, {'NO_CACHE'})
-                       end
-               end
-       end
-}
-
 return predict