[Feature request] Ability to serve expired records in the cache by type.
Benno Overeinder
benno at NLnetLabs.nl
Thu May 11 09:32:51 UTC 2023
On 10/05/2023 22:05, alpominth at disroot.org wrote:
> I tested here with a sample configuration and low TTLs, I didn't see any traffic going out the network interface (by using Wireshark).
Perhaps there is confusion between proactive vs reactive prefetching.
Unbound does not proactively prefetch cache entries that expire. Only
cache entries that are queried *and* are within the <= 10% TTL boundary
are answered directly from the cache to the client and resolved in
parallel to refresh the cache.
-- Benno
>>
>> Not sure why prefetch option does not work for you without enabling serve-expired. How did you test the prefetch option?
>>
>> From the manual page:
>>
>> prefetch: <yes or no>
>> If yes, message cache elements are prefetched before they expire to keep the cache up to date. Turning it on gives about 10 percent more traffic and load on the machine, but popular items do not expire from the cache.
>>
>> Prefetch causes active queried cached items to be prefetched when they are at 10% of their TTL. If the cache item is not queried during this time, the item will expire.
>>
>> For serve-expired feature, there are two alternatives available, see the documentation: https://unbound.docs.nlnetlabs.nl/en/latest/topics/core/serve-stale.html
>>
>> -- Benno
>>
>> > On 8 May 2023, at 00:31, alpominth--- via Unbound-users <unbound-users at lists.nlnetlabs.nl> wrote:
>> >
>> > Here in my tests, prefetch option only works when serve-expired is enabled.
>> >
>> > Here is one of my configuration files:
>> >
>> > server:
>> > interface: 127.0.0.1
>> > interface: ::1
>> > port: 53
>> > cache-max-ttl: 21600
>> > cache-min-ttl: 21600
>> > cache-max-negative-ttl: 21600
>> > val-bogus-ttl: 0
>> > infra-host-ttl: 21600
>> > prefetch: yes
>> > serve-expired: yes
>> > serve-expired-ttl: 2592000
>> > delay-close: 10000
>> > chroot: ""
>> > username: "permcache"
>> > directory: ""
>> > pidfile: ""
>> > do-not-query-localhost: no
>> > module-config: "validator cachedb iterator"
>> >
>> > cachedb:
>> > backend: redis
>> > # redis-server-host: ::1
>> > # redis-server-port: 6379
>> > redis-server-password: "blah123"
>> > redis-server-path: "/opt/permcache/db/redis-server.sock"
>> > redis-timeout: 5000
>> >
>> > forward-zone:
>> > name: "."
>> > forward-addr: ::1 at 10053
>> >
>> >
>> > /\ Prefetch works, but the negative and host cache are cached for 1 month when prefetching is enabled, I would like to set a very short caching time for them, 1 or 2 days.
>> >
>> > Options for controlling the expired host cache and negative cache separately would be a very good idea, as negative and host entries would have different TTLs.
>> >
>> > The options could be:
>> >
>> > serve-expired-negative-ttl: <seconds>
>> > serve-expired-infra-host-ttl: <seconds>
>> >
>>
--
Benno J. Overeinder
NLnet Labs
https://www.nlnetlabs.nl/
More information about the Unbound-users
mailing list