Preston Crow
2012-01-11 00:55:01 UTC
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.)
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.)