dnsbench

package module
v0.0.0-...-25470ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

README

DNSBench

A simple DNS server benchmarking tool.

Have you ever needed to troubleshoot a DNS server? Or maybe you want to do some benchmarking before trouble arises. DNSBench is a simple command-line tool that can help you with that.

Installation

With Go installed:

go get -u github.com/askcom/dnsbench/cmd/dnsbench

Usage and examples

dnsbench <nameserver> [flags]
  -concurrency int
        Numer of concurrent requests (default 10)
  -count int
        Number of requests to make (default 1000)
  -interval duration
        Reporting interval (default 5s)
  -local
        Use local resolver
  -names string
        File containing names to request (default "-")
  -qps int
        QPS to attempt for each worker (0 for no limit)

Example 1: Benchmark DNS using local resolver:

$ echo "example.com" | dnsbench -local

Reading names from /dev/stdin
Benchmarking...

# requests errors min  [ p50  p95  p99  p999] max  qps

Finished 1000 requests

# latency summary
   1000       0   2.21    [6.31 24.12 36.80 72.35] 72.35  639.33

Concurrency level: 10
Time taken for tests: 1.56 seconds
Completed Requests: 1000
Failed Requests: 0
Requests per second: 639.33 [#/sec] (mean)
Time per request: 8.23 [ms] (mean)
Fastest request: 2.21 [ms]
Slowest request: 72.35 [ms]

Example 2: Benchmark a specified nameserver with a file of domains:

dnsbench <nameserver ip> -names "domains_to_lookup.txt"

Reading names from domains_to_lookup.txt
Benchmarking...

with domains listed on individual lines of domains_to_lookup.txt, such as:

example.com
google.com
foobar.com

Status

DNSBench is currently under active development with upcoming improvements targetting:

  • Documentation
  • Command-line useability
  • Decoupling command-line and DNS lookup logic of source
  • Testing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayReport

func DisplayReport(hist *hdrhistogram.Histogram, errors int64, dur float64)

DisplayReport prints a HDR histogram summary of a DNS benchmark run

func LocalResolve

func LocalResolve(names []string, count int, qps int, results chan<- *Result)

LocalResolve does DNS lookups using the local resolver

func ReadNames

func ReadNames(path string) ([]string, error)

ReadNames reads domain names from a given file and returns them in a slice

func Resolve

func Resolve(nameserver string, names []string, count int, qps int, results chan<- *Result)

Resolve does DNS lookups using specified nameserver

Types

type Result

type Result struct {
	Duration time.Duration
	Error    bool
}

Result holds the result of an individual dns lookup

type Stats

type Stats struct {
	Errors    int64
	Hist      *hdrhistogram.Histogram
	IntErrors int64
	IntHist   *hdrhistogram.Histogram
}

Stats holds a summary of DNS benchmark results

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL