[Dnsmasq-discuss] Dnsmasq with Gigantic hosts file

Preston Crow pc-dnsmasq at crowcastle.net
Wed Jan 11 00:55:01 GMT 2012


I'm running dnsmasq with a large hosts file, and it's taking about a 
minute to start up, which doesn't seem right.  Specifically, for the 
first minute while it is initializing, it does not respond to DNS 
requests.  If I attach to it with strace, I see it doing a sequence of 
4K reads of the hosts file, and I can see it slowing down as it 
progresses.  After every 8 reads, there is one brk() syscall.

I assume that the slow part is in processing the hosts that it's reading.

My setup is using only DNS, no DHCP.  I have two hosts files, the first 
is short, only 1116 bytes, but the second is over 1MB and includes over 
50,000 entries.

If you're curious, the second file is a copy of the NIS hosts file, as 
I've had performance problems with NIS over VPN, so I grab it 
occasionally and serve it locally.  It works great once it's 
initialized, but this is my laptop, not an always-up server, so the 
extra minute is painful.  (It's a new high-end laptop with tons of 
memory, fast CPU, and an SSD, so it I shouldn't hit any issues there.)

 From what I've read, including a thread with the same subject line in 
the archives, the startup time should be just a second or two, not a 
minute, though that was five years ago:
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2007q1/001134.html

My config file has:

resolv-file=/etc/resolv.conf.upstream
server=/{some domain}/ip.number.here
... (26 server lines total)
no-dhcp-interface=
addn-hosts=/etc/hosts.nis


Any suggestions for how to fix this?



More information about the Dnsmasq-discuss mailing list