Rectifying DNS Overload...
Posted: Mon Dec 17, 2018 8:46 pm
After installing a local caching DNS resolver (unbound) on my local network, I came to realize that MeteoBridge is among the top 5 systems on my home network in terms of generated DNS requests. For my configuration (sending data to 11-plus weather sites), my TL-MR3020 (v1) generates more than 1 DNS request every 2 seconds, and the vast majority of these are repetitive, yet the hosts have non-zero TTL (time to live).
This is a typical side effect of an application using stock libc - every application call to send data to a host will result in a call to the DNS server, because libc doesn't cache responses or pay any attention to the TTL for a given address resolution.
After much consideration, it turns out that it is relatively easy to solve this - by enabling the dnsmasq caching DNS server that is already installed on the OpenWrt platform that MeteoBridge runs on top of. In fact, if you are using the WiFi capability of the TL-MR3020, AND your WiFi SSID name starts with "MB", you will already have dnsmasq running on your MeteoBridge, although I doubt it is providing any benefit until you configure it properly, which I have figured out. I have also figured out how to stop the setup.sh startup script from shutting down dnsmasq so that it remains available for MeteoBridge to use even if you're not using WiFi as an Access Point.
Before I explain how I do all this, I'm going to ask (by way of this message) the MeteoBridge staff if it is OK for me to explain it. My changes are exclusively done through the OpenWrt interface and the provided hook into rc.local, and once completed the memory footprint of running apps is increased by less than 1MB, leaving plenty of room for all the MeteoBridge stuff to run (while also significantly reducing network traffic and name resolution delays).
So, MeteoBridge folks - is it permissible for me to share how to get dnsmasq running, so as to reduce (significantly) the unnecessary DNS overhead that MeteoBridge is generating?
This is a typical side effect of an application using stock libc - every application call to send data to a host will result in a call to the DNS server, because libc doesn't cache responses or pay any attention to the TTL for a given address resolution.
After much consideration, it turns out that it is relatively easy to solve this - by enabling the dnsmasq caching DNS server that is already installed on the OpenWrt platform that MeteoBridge runs on top of. In fact, if you are using the WiFi capability of the TL-MR3020, AND your WiFi SSID name starts with "MB", you will already have dnsmasq running on your MeteoBridge, although I doubt it is providing any benefit until you configure it properly, which I have figured out. I have also figured out how to stop the setup.sh startup script from shutting down dnsmasq so that it remains available for MeteoBridge to use even if you're not using WiFi as an Access Point.
Before I explain how I do all this, I'm going to ask (by way of this message) the MeteoBridge staff if it is OK for me to explain it. My changes are exclusively done through the OpenWrt interface and the provided hook into rc.local, and once completed the memory footprint of running apps is increased by less than 1MB, leaving plenty of room for all the MeteoBridge stuff to run (while also significantly reducing network traffic and name resolution delays).
So, MeteoBridge folks - is it permissible for me to share how to get dnsmasq running, so as to reduce (significantly) the unnecessary DNS overhead that MeteoBridge is generating?