[Dnsmasq-discuss] reading /etc/hosts takes 6 minutes !?!?!
Simon Kelley
simon at thekelleys.org.uk
Fri Oct 27 20:11:01 BST 2006
koko wrote:
> rasz at capek:/etc$ cat /etc/hosts | grep 127 | uniq | wc -l
> 52076
> rasz at capek:/etc$ sudo /etc/init.d/dnsmasq restart
> rasz at capek:/etc$ cat /var/log/syslog
>
> Oct 27 08:19:12 capek dnsmasq[8060]: exiting on receipt of SIGTERM
> Oct 27 08:19:12 capek dnsmasq[8223]: started, version 2.33 cachesize 150
> Oct 27 08:19:12 capek dnsmasq[8223]: compile time options: IPv6
> GNU-getopt no-ISC-leasefile DBus I18N
> Oct 27 08:19:12 capek dnsmasq[8223]: reading /etc/resolv.conf
> Oct 27 08:19:12 capek dnsmasq[8223]: using nameserver 212.76.39.211#53
> Oct 27 08:19:12 capek dnsmasq[8223]: using nameserver 212.76.39.205#53
> Oct 27 08:19:12 capek dnsmasq[8223]: ignoring nameserver 127.0.0.1 -
> local interface
> Oct 27 08:24:55 capek dnsmasq[8223]: read /etc/hosts - 52076 addresses
>
> Is this normal behaviour? this is 6 minutes of constant 100% cpu. Is
> 50k of entries just too much for it?
>
> rasz at capek:/etc$ cat /proc/cpuinfo | grep Hz
> cpu MHz : 2057.069
> rasz at capek:/etc$ cat /proc/meminfo | grep mTo
> MemTotal: 515868 kB
>
I just did some hacking, and added some special case processing for the
case of mutiple repeated addresses in /etc/hosts, plus some other
efficiency improvements. I reduced the time to read ~28000 lines on a
1.6GHz CPU from 38 seconds to 200 milliseconds. The code will be in
version 2.35, out soon to fix the OpenBSD 4.0 brokenness.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list