WeaveDNS is a service discovery solution for containers on Weave (network), a a networking solution for Docker containers from Weaveworks.
WeaveDNS was introduced in version 0.9 of Weave, but in Weave 1.1, it was redesigned and nicknamed Gossip DNS. With Gossip DNS, container “registrations are broadcast to all weaveDNS instances, which subsequently hold all entries in memory and handle lookups locally.” That has led to performance and latency gains and a few other benefits.
From the official blog announcement:
In the original version of weaveDNS, coordination between instances was via mDNS – a UDP-based broadcast protocol. When a container was started, it registered with the local weaveDNS instance, which stored an entry in local memory. When a container wanted to query for an address, the local weaveDNS instance broadcast the query to all other weaveDNS instances, which would then answer from local memory.
This approach presented two problems:
- Firstly lookups (by far the most common operation) were significantly more expensive than registrations, involving multiple network operations. A cache was added to address this, however this also added complexity.
- Secondly, when doing a lookup in the presence of failures, there was no way to know when you had heard from all the running weaveDNS instances – hence we implemented a timeout and lived with some requests taking long than desired. The performance was even worse when doing negative queries (ie queries which have no answer); weaveDNS would have to wait for all the instances to respond (or to timeout) before returning a negative result to the client.
The new implementation reverses this design – registrations are broadcast to all weaveDNS instances, which subsequently hold all entries in memory and handle lookups locally. With Weave 1.1 the most common operation is a cheap, local in-memory lookup. To demonstrate the performance difference, we ran dnsperf against Weave 1.0 and 1.1 running on a 5-machine cluster, with each host running 10 containers. The workload was 50% positive queries, and 50% negative queries.
Continue reading to learn more about the performance difference between WeaveDNS and ‘Gossip’ DNS.