coredns/middleware/loadbalance
Miek Gieben 84dfdab584 Cache elements of State
Cache the size and the do bit whenever someone asked for it. We can

probably add more:



PASS

BenchmarkStateDo-4  	100000000	        11.9 ns/op

BenchmarkStateSize-4	 5000000	       265 ns/op

ok  	github.com/miekg/coredns/middleware	2.828s



PASS

BenchmarkStateDo-4  	1000000000	         2.86 ns/op

BenchmarkStateSize-4	500000000	         3.10 ns/op

ok  	github.com/miekg/coredns/middleware	5.032s



This PR also includes some testing cleanups as well.
2016-04-04 08:19:06 +01:00
..
handler.go Add roundrobin middleware 2016-03-23 21:38:35 +00:00
loadbalance.go Add test for CNAME ordering 2016-03-26 13:26:46 +00:00
loadbalance_test.go Cache elements of State 2016-04-04 08:19:06 +01:00
README.md middleware: change documentation filenames to README.md 2016-04-01 18:26:18 -04:00

loadbalance

loadbalance acts as a round-robin DNS loadbalancer by randomizing A and AAAA records in the message. See Wikipedia about the pros and cons on this setup.

It will take care to sort any CNAMEs before any address records.

Syntax

loadbalance [policy]
  • policy is how to balance, the default is "round_robin"

Examples

loadbalance round_robin