Skip to content

Instantly share code, notes, and snippets.

@tmthrgd
Last active September 9, 2018 12:44
Show Gist options
  • Save tmthrgd/cfcc4b245267cd8d2571eaeeda0f83ad to your computer and use it in GitHub Desktop.
Save tmthrgd/cfcc4b245267cd8d2571eaeeda0f83ad to your computer and use it in GitHub Desktop.
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 200 example.com
Benchmarking 127.0.0.1:8053 via udp with 200 conncurrent requests
Total requests: 200000 of 200000 (100.0%)
DNS success codes: 200000
DNS response codes
NOERROR: 200000
Time taken for tests: 1.158127442s
Questions per second: 172692.6
DNS timings, 200000 datapoints
min: 0s
mean: 1.150783ms
[+/-sd]: 590.874µs
max: 7.864319ms
DNS distribution, 200000 datapoints
LATENCY | | COUNT
+------------+---------------------------------------------+-------+
131.071µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄ | 21319
393.215µs | ▄▄ | 3089
655.359µs | ▄▄ | 2843
917.503µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 55034
1.179647ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 68461
1.441791ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 22082
1.703935ms | ▄▄ | 3891
1.966079ms | ▄▄▄▄▄ | 8295
2.228223ms | ▄▄▄▄▄ | 8101
2.490367ms | ▄▄ | 3078
2.752511ms | | 790
3.014655ms | ▄ | 1026
3.276799ms | ▄ | 958
3.538943ms | | 396
3.801087ms | | 167
4.063231ms | | 192
4.325375ms | | 126
4.587519ms | | 48
4.849663ms | | 38
5.111807ms | | 29
5.373951ms | | 17
5.636095ms | | 3
5.898239ms | | 5
6.160383ms | | 5
6.422527ms | | 2
6.684671ms | | 0
6.946815ms | | 2
7.208959ms | | 2
7.471103ms | | 0
7.733247ms | | 1
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 200 example.com
Benchmarking 127.0.0.1:8053 via udp with 200 conncurrent requests
Total requests: 200000 of 200000 (100.0%)
DNS success codes: 200000
DNS response codes
NOERROR: 200000
Time taken for tests: 2.667634476s
Questions per second: 74972.8
DNS timings, 200000 datapoints
min: 0s
mean: 2.661894ms
[+/-sd]: 467.442µs
max: 9.437183ms
DNS distribution, 200000 datapoints
LATENCY | | COUNT
+------------+---------------------------------------------+-------+
131.071µs | | 65
393.215µs | | 79
655.359µs | | 150
917.503µs | | 158
1.179647ms | | 225
1.441791ms | | 202
1.703935ms | | 768
1.966079ms | ▄▄▄ | 4791
2.228223ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 26134
2.490367ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 72435
2.752511ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 61219
3.014655ms | ▄▄▄▄▄▄▄▄▄▄▄▄ | 19550
3.276799ms | ▄▄▄ | 5848
3.538943ms | ▄ | 2379
3.801087ms | ▄ | 1546
4.063231ms | ▄ | 899
4.325375ms | | 782
4.587519ms | | 713
4.849663ms | | 621
5.111807ms | | 595
5.373951ms | | 282
5.636095ms | | 121
5.898239ms | | 184
6.160383ms | | 128
6.422527ms | | 48
6.684671ms | | 24
6.946815ms | | 31
7.208959ms | | 9
7.471103ms | | 6
7.733247ms | | 5
7.995391ms | | 2
8.257535ms | | 0
8.650751ms | | 0
9.175039ms | | 1
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 200 example.com
Benchmarking 127.0.0.1:8053 via udp with 200 conncurrent requests
Total requests: 200000 of 200000 (100.0%)
DNS success codes: 200000
DNS response codes
NOERROR: 200000
Time taken for tests: 1.079904602s
Questions per second: 185201.5
DNS timings, 200000 datapoints
min: 0s
mean: 1.069635ms
[+/-sd]: 561.672µs
max: 6.291455ms
DNS distribution, 200000 datapoints
LATENCY | | COUNT
+------------+---------------------------------------------+-------+
131.071µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄ | 23633
393.215µs | ▄▄ | 3336
655.359µs | ▄▄▄ | 4540
917.503µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 77875
1.179647ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 53964
1.441791ms | ▄▄▄▄▄▄ | 10942
1.703935ms | ▄▄ | 3584
1.966079ms | ▄▄▄▄▄▄ | 11771
2.228223ms | ▄▄▄ | 5714
2.490367ms | ▄ | 1597
2.752511ms | | 556
3.014655ms | ▄ | 1298
3.276799ms | | 687
3.538943ms | | 156
3.801087ms | | 100
4.063231ms | | 128
4.325375ms | | 55
4.587519ms | | 27
4.849663ms | | 13
5.111807ms | | 16
5.373951ms | | 4
5.636095ms | | 2
5.898239ms | | 1
6.160383ms | | 1
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 200 example.com
Benchmarking 127.0.0.1:8053 via udp with 200 conncurrent requests
Total requests: 200000 of 200000 (100.0%)
DNS success codes: 200000
DNS response codes
NOERROR: 200000
Time taken for tests: 1.093059049s
Questions per second: 182972.7
DNS timings, 200000 datapoints
min: 0s
mean: 1.08194ms
[+/-sd]: 569.046µs
max: 8.388607ms
DNS distribution, 200000 datapoints
LATENCY | | COUNT
+------------+---------------------------------------------+-------+
131.071µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 23322
393.215µs | ▄▄ | 3411
655.359µs | ▄▄▄ | 4603
917.503µs | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 73508
1.179647ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | 56656
1.441791ms | ▄▄▄▄▄▄▄ | 12783
1.703935ms | ▄▄ | 3369
1.966079ms | ▄▄▄▄▄▄▄ | 11173
2.228223ms | ▄▄▄ | 5927
2.490367ms | ▄ | 2055
2.752511ms | | 659
3.014655ms | ▄ | 1213
3.276799ms | | 716
3.538943ms | | 232
3.801087ms | | 97
4.063231ms | | 113
4.325375ms | | 78
4.587519ms | | 30
4.849663ms | | 15
5.111807ms | | 22
5.373951ms | | 7
5.636095ms | | 1
5.898239ms | | 4
6.160383ms | | 3
6.422527ms | | 0
6.684671ms | | 2
6.946815ms | | 0
7.208959ms | | 0
7.471103ms | | 0
7.733247ms | | 0
7.995391ms | | 0
8.257535ms | | 1
// +build ignore
package main
import (
"flag"
"log"
"github.com/miekg/dns"
)
func init() {
log.SetFlags(log.Lshortfile)
}
func handler(rw dns.ResponseWriter, req *dns.Msg) {
m := new(dns.Msg)
m.SetReply(req)
m.Extra = make([]dns.RR, 1)
m.Extra[0] = &dns.TXT{
Hdr: dns.RR_Header{Name: m.Question[0].Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 0},
Txt: []string{"testy boy"},
}
rw.WriteMsg(m)
}
func main() {
addr := flag.String("addr", ":8053", "the address to listen on")
max := flag.Bool("max", false, "whether to use the maximum or minimum UDP msg buffer size")
flag.Parse()
size := dns.MinMsgSize
if *max {
size = dns.MaxMsgSize
}
srv := &dns.Server{
Addr: *addr,
Net: "udp",
Handler: dns.HandlerFunc(handler),
UDPSize: size,
NotifyStartedFunc: func() {
log.Printf("listening on %s", *addr)
},
}
defer srv.Shutdown()
if err := srv.ListenAndServe(); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment