[PATCH] DNS cache for Konqueror/KIO

Andreas Hartmetz ahartmetz at gmail.com
Mon Jun 23 02:32:18 BST 2008

2008/6/22 Roland Harnau <truthandprogress at googlemail.com>:
> Hello,
> KIO's asynchronous design and some peculiarities in Qt's network
> department often result in concurrent  queries to resolve host names,
> especially if Konquerer launches its huge slave army. As witnessed by
> several bug reports (e.g. 162600)  some kind of router can't cope with
> this very well. The reason (at least in my case) is not the "crappy"
> handling of IPv6 queries in itself. An analysis with tcpdump reveals
> there are in general problems with concurrent queries to resolve the
> same name if the requested record (AAAA or A) does not exist. A
> solution (or workaround, as you like it) is a local DNS cache. The
> core of my patch is therefore a reimplementation of Qt's asynchronous
> resolver QHostInfo::lookupHost  in form of
> HostInfoAgent::lookupHost.with integrated cache and its integration
> into KIO. The cache lives in a central place,  in the application's
> address space,  but is used by  several slaves (instances of classes
> derived from TCPSlaveBase) living in separate process contexts. So
> some IPC is necessary, and I have simply used the socket connection
> between the slave and its counterpart in the application's address
> space.
I remember the discussion on #kde-devel and this might, unfortunately,
be the only solution apart from telling users to buy better plastic
routers (a term used here to describe "consumer grade" routing
hardware). Some systems were running nscd, the name service cache
daemon, a long time ago. At least Suse 5.3 did it... it does the same
thing as your patch but for the whole system. I wonder why it fell out
of fashion.
Did you consider making the name cache even more central like kded or
kdeinit? That should give us more cache hits in some cases. And it
brings us back to kded being too unstable, oh well. We need to solve
that one way or another anyway.
The patch looks quite good (small and blends well into the rest of the
code) apart from a very minor formatting mistake (we don't indent
namespaces.). To be honest I only read it for a couple of minutes.
Anyway, if Thiago says it's okay it's okay. He knows both the Qt
networking classes and most of the KDE networking code.

More information about the kde-core-devel mailing list