-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove hardcoded/unnecessary local-ttl/cache-size values in dnsmasq.conf #1698
Conversation
- The local ttl value tells clients to cache local responses for 5 mins. This makes it so /etc/host and dhcp updates can take up to 5 mins to propigate. In almost all cases these should be instant. From DNSMasq man page: When replying with information from /etc/hosts or configuration or the DHCP leases file dnsmasq by default sets the time-to-live field to zero, meaning that the requester should not itself cache the information. This is the correct thing to do in almost all situations. This option allows a time-to-live (in seconds) to be given for these replies. This will reduce the load on the server at the expense of clients using stale data under some circumstances.
Having this hardcoded makes it so you cannot permanatly override it. The default value of 150 should be more than fine for most users, and for anyone who needs to increase/change it can not do so without causing 'illegal repeated keyword' errors in dnsmasq.
Perhaps a better way to go about this would be to add a setupVars config setting with a default assigned by the installer? Also, make sure to base your code off of development. |
Without setting cache-size at all the default is just 150 - much too low in my opinion. |
@mibere In a world of 300s ttl's and client side caching I don't think the cache is being used as much as you think. In additions, since your client and pi-hole will have matching ttl's follow up requests from the same client will be misses. So, the only cache hits you get are for common duplicate requests across clients. So a large cache here just burns memory. If you want details on the performance of pi-hole dns cache: $ sudo pkill -USR1 dnsmasq
$ cat /var/log/pihole.log | grep "cache size" Wait a bit, and do it again, and you'll get a good idea of effectiveness.
|
We've been having some discussion internally about this. Firstly,
We've verified that setting this does not affect the upstream TTL's served to the Pi-hole clients, but does affect domains sinkholed by gravity - so we've agreed that changing this to 2 will make the whitelisting experience much better for the end user. As for DHCP leases, having a low TTL doesn't negatively affect clients who see Pi-hole as their DHCP server as all queries can immediately be answered from This leads us to the discussion on
We believe (through our own testing and observation) that altering
With this in mind, what benefits would you personally see by removing these values? |
@WaLLy3K Thanks for the great response.
I apologize in advance -- I should of checked the DNSmasq code first. I think you're right, I may be way off on this. Looking at how dm caching works it does appear that a larger cache value will greatly benefit users with large block lists. With minimal impact for more casual users. Since, to be honest, if I was really hard up for memory I'd be optimizing php for the admin... So, I think it'll be best if I close this PR, and if I get a chance pull these out as hardcodes, and resubmit. |
Hey @celly, I'm glad you're happy with the proposed solution for Personally, I was open to having Also (from what we understand), the memory value for a We're looking back over the codebase and seeing what we can optimise - among other things, Web Admin is definitely something we've got in mind. 😄 Since you've mentioned it, I'll go ahead and close this PR - but thank you for the resulting conversation! |
* Decreasing value should benefit clients when whitelisting blocked sites, [as per this discussion](#1698 (comment)).
By submitting this pull request, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your PR:
Please submit all pull requests against the
development
branch. Failure to do so will delay or deny your requestHow familiar are you with the codebase?:
3.2
Most users do not need these values set, and they seem to be an artifact of the original code base. By having them hard coded in this file, it makes it so you cannot permanently overwrite them since they will be overwritten every time this the config file is written. You can also not add them to a custom config, since they will be error as dupe.
This template was created based on the work of
udemy-dl
.