lancachenet / lancache-dns

DNS Docker service for a lancache.
https://hub.docker.com/r/lancachenet/lancache-dns/
MIT License
280 stars 73 forks source link

cache TTLs set to 0 with forward only #131

Closed MathewBurnett closed 2 years ago

MathewBurnett commented 2 years ago
    max-cache-ttl 0;
    max-ncache-ttl 0;
    forward only;

see #114

VibroAxe commented 2 years ago

LGTM, @mintopia to confirm in a "real" situation as slan doesn't use LCN

stale[bot] commented 2 years ago

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Teruell commented 1 year ago

Would it be possible to make these values configurable? Setting these to 0 caused me some troubleshooting time as it also seems to return all queries sent upstream as 0 TTL. I've set it manually, but just wondering if it might make sense to put these into .env

markkundinger commented 1 year ago

Hey guys, I don't know if it's appropriate to put this in this pull request or a separate bug report, but having max-cache-ttl=0 seems to cause some problems that slow down name resolution performance.

the GRC Dnsbench program was showing the "cached" performance as highly variable, sometimes .049 seconds, and sometimes and sometimes over a full second(!) to resolve a 'cached' domain name.

Per the BIND documentation page, max-cache-ttl should not be zero: https://bind9.readthedocs.io/en/latest/reference.html


  max-ncache-ttl[](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-max-ncache-ttl)

Grammar: max-ncache-ttl <duration>;

Blocks: options, view

Tags: server

Specifies the maximum retention time (in seconds) for storage of negative answers in the server’s cache.

To reduce network traffic and increase performance, the server stores negative answers. [max-ncache-ttl](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-max-ncache-ttl) is used to set a maximum retention time for these answers in the server, in seconds. For convenience, TTL-style time-unit suffixes may be used to specify the value. It also accepts ISO 8601 duration formats.

The default [max-ncache-ttl](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-max-ncache-ttl) is 10800 seconds (3 hours). [max-ncache-ttl](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-max-ncache-ttl) cannot exceed 7 days and is silently truncated to 7 days if set to a greater value.

when I manually modifiy the the max-cache-ttl to say 1000, performance changes to a min/max of 0.000 seconds (so instance as far as the benchmark is concerned). This improvement happens with the max set as low as 2 seconds.

In addition, I use a pihole downstream of lancache. the max-cache-ttl setting of 0 causes the pihole's cached performance to be slower too.

Teruell commented 1 year ago

I still advocate for this being configurable in .env. I've stopped auto updating so that I can change this manually when I update.