CoreDNS Performance Testing

CoreDNS performance testing.

2 minute read
Modified: 15 Oct, 2017
Miek Gieben

As CoreDNS is an inception level project under the CNCF which means we have
access to the physical cloud infrastructure of Packet, a bare metal(!)
cloud provider. Physical machines imply performance and also because you get an entire machine you
can use them for performance metrics.

For CoreDNS we have a few Benchmark tests (from the Go standard
library) that haven’t seen much use.
Typically you run these before your change and then after your and then use a tool like
benchcmp to compare the results and impress
your PR’s reviewers. This is all pretty manual, a more automated (and visual!) way would be welcome.

Our new Packet machines to the rescue. We’ve setup the following work flow:

GitHub > webhook > mbench > prometheus > grafana

I.e. we configured a webhook that gets triggered on a pull
request and then via some
Caddy proxy triggery gets delivered to
webhook. Webhook then kicks of a shell
script,
that pulls down CoreDNS’ repo and the correct pull request.
1

This benchmark script does nothing more
than run the bench mark tests: go test -run='' -bench=. -benchmem ./... 2>/dev/null).

The output from these tests, i.e:

BenchmarkRequestDo-8 1000000000 2.11 ns/op 0 B/op 0 allocs/op

… is written into the named pipe which is then picked up by mbench
and converted into Prometheus metrics:

Benchmark dashboard.

The end result of all this is that if someone adds an optimization it will be immediately visible
in the stats. Any new pull request shows up automatically and any new benchmark function will also
be automatically discovered.

Yes, this script parses the JSON with grep, ultimately that was the only way to make it reliably work. [return]