{"id":23666600,"url":"https://github.com/redsift/dnstrace","last_synced_at":"2025-09-01T19:32:27.119Z","repository":{"id":41142609,"uuid":"100526443","full_name":"redsift/dnstrace","owner":"redsift","description":"Command-line DNS benchmark","archived":false,"fork":false,"pushed_at":"2023-03-19T14:42:45.000Z","size":57,"stargazers_count":79,"open_issues_count":2,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-06-18T23:15:06.726Z","etag":null,"topics":["benchmark","command-line","dns"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redsift.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-16T19:45:24.000Z","updated_at":"2024-02-24T03:39:42.000Z","dependencies_parsed_at":"2024-06-18T22:57:09.632Z","dependency_job_id":"90e24868-e9c0-40e5-a1bb-b04cf6460c5b","html_url":"https://github.com/redsift/dnstrace","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fdnstrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fdnstrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fdnstrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fdnstrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redsift","download_url":"https://codeload.github.com/redsift/dnstrace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231713109,"owners_count":18415191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","command-line","dns"],"created_at":"2024-12-29T07:33:13.217Z","updated_at":"2024-12-29T07:33:19.079Z","avatar_url":"https://github.com/redsift.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DNStrace\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/redsift/dnstrace)](https://goreportcard.com/report/github.com/redsift/dnstrace)\n[![Release](https://img.shields.io/github/release/redsift/dnstrace/all.svg)](https://github.com/redsift/dnstrace/releases)\n[![CircleCI](https://circleci.com/gh/redsift/dnstrace.svg?style=shield)](https://circleci.com/gh/redsift/dnstrace)\n[![Docker Image](https://images.microbadger.com/badges/image/redsift/dnstrace.svg)](https://microbadger.com/images/redsift/dnstrace)\n\nCommand-line DNS benchmark tool built to stress test and measure the performance of DNS servers with commodity hardware.\nThis tool typically consumes ~30kB per concurrent connection and can maintain ~30,000 QPS per modern core if your server, OS and network allows you to reach suitable levels of concurrency.\n\nDNStrace bypasses OS resolvers and is provided as a Docker packaged prebuilt static binary.\nBasic latency measurement, result checking and histograms are supported.\nCurrently, only `A`, `AAAA` and `TXT` questions are supported.\n\n## Usage\n\n```\n$ dnstrace --help\n\nusage: dnstrace [\u003cflags\u003e] \u003cqueries\u003e...\n\nA DNS benchmark.\n\nFlags:\n      --help                   Show context-sensitive help (also try --help-long\n                               and --help-man).\n  -s, --server=\"127.0.0.1\"     DNS server IP:port to test.\n  -t, --type=A                 Query type.\n  -n, --number=1               Number of queries to issue. Note that the total\n                               number of queries issued =\n                               number*concurrency*len(queries).\n  -c, --concurrency=1          Number of concurrent queries to issue.\n  -l, --rate-limit=0           Apply a global questions / second rate limit.\n  -e, --expect=EXPECT ...      Expect a specific response.\n  -r, --recurse                Allow DNS recursion.\n      --edns0=0                Enable EDNS0 with specified size.\n      --tcp                    Use TCP fot DNS requests.\n      --write=1s               DNS write timeout.\n      --read=4s                DNS read timeout.\n      --codes                  Enable counting DNS return codes.\n      --min=400µs              Minimum value for timing histogram.\n      --max=4s                 Maximum value for histogram.\n      --precision=[1-5]        Significant figure for histogram precision.\n      --distribution           Display distribution histogram of timings to\n                               stdout.\n      --csv=/path/to/file.csv  Export distribution to CSV.\n      --io-errors              Log I/O errors to stderr.\n      --silent                 Disable stdout.\n      --color                  ANSI Color output.\n      --version                Show application version.\n\nArgs:\n  \u003cqueries\u003e  Queries to issue.\n```\n\n## Warning\n\nWhile `dnstrace` is helpful for testing round trip latency via public networks,\nthe code was primarily created to provide an [apachebench](https://en.wikipedia.org/wiki/ApacheBench)\nstyle tool for testing your own infrastructure.\n\nIt is thus very easy to create significant DNS load with non default settings.\n**Do not do this to public DNS services**. You will most likely flag your IP.\n\n## Installation\n\n### go get\n\n`go get github.com/redsift/dnstrace` will install the binary in your `$GOPATH/bin`.\nOn OS-X, the native binary will outperform the Docker container below running under HyperKit significantly e.g. 30% more throughput, 30% lower latency and a 4x decrease in timing spread\n\n### Docker\n\n[![Latest](https://images.microbadger.com/badges/version/redsift/dnstrace.svg)](https://microbadger.com/images/redsift/dnstrace)\n\nThis tool is available in a prebuilt image.\n\n`docker run redsift/dnstrace --help`\n\nIf your local test setup lets you reach 50k QPS and above, you can expect the docker networking to add ~2% overhead to throughput and ~8% to mean latency (tested on Linux Docker 1.12.3).\nIf this is significant for your purposes you may wish to run with `--net=host`\n\n## Bash/ZSH Shell Completion\n\n`./dnstrace --completion-script-bash` and `./dnstrace --completion-script-zsh` will create shell completion scripts.\n\ne.g.\n```\n$ eval \"$(./dnstrace --completion-script-zsh)\"\n\n$ ./dnstrace --concurrency\n  --codes         --distribution  --io-errors     --precision     --server        --version\n  --color         --edns0         --max           --rate-limit    --silent        --write\n  --concurrency   --expect        --min           --read          --tcp\n  --csv           --help          --number        --recurse       --type\n\n```\n\n## C10K and the like\n\nAs you approach thousands of concurrent connections on OS-X, you may run into connection errors due to insufficient file handles or threads. This is likely due to process limits so remember to adjust these limits if you intent to increase concurrency levels beyond 1000.\n\nNote that using `sudo ulimit` will create a root shell, adjusts its limits, and then exit causing no real effect. Instead use `launchctl` first on OS-X.\n\n```\n$ sudo launchctl limit maxfiles 1000000 1000000\n$ ulimit -n 12288\n```\n\n## Progress\n\nFor long runs, the user can send a SIGHUP via `kill -1 pid` to get the current progress counts.\n\n## Example\n\n```\n$ docker run redsift/dnstrace -n 10 -c 10 --server 8.8.8.8 --recurse redsift.io\n\nBenchmarking 8.8.8.8:53 via udp with 10 conncurrent requests\n\n\nTotal requests:\t 100 of 100 (100.0%)\nDNS success codes:     \t100\n\nDNS response codes\n       \tNOERROR:       \t100\n\nTime taken for tests:  \t 107.091332ms\nQuestions per second:  \t 933.8\n\nDNS timings, 100 datapoints\n       \t min:  \t\t 3.145728ms\n       \t mean: \t\t 9.484369ms\n       \t [+/-sd]:    5.527339ms\n       \t max:  \t\t 27.262975ms\n\nDNS distribution, 100 datapoints\n    LATENCY   |                                             | COUNT\n+-------------+---------------------------------------------+-------+\n  3.276799ms  | ▄▄▄▄▄▄▄▄                                    |     2\n  3.538943ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  3.801087ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  4.063231ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  4.325375ms  | ▄▄▄▄▄▄▄▄                                    |     2\n  4.587519ms  |                                             |     0\n  4.849663ms  |                                             |     0\n  5.111807ms  | ▄▄▄▄                                        |     1\n  5.373951ms  | ▄▄▄▄                                        |     1\n  5.636095ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                            |     4\n  5.898239ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  6.160383ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                        |     5\n  6.422527ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  6.684671ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                        |     5\n  6.946815ms  | ▄▄▄▄▄▄▄▄                                    |     2\n  7.208959ms  | ▄▄▄▄                                        |     1\n  7.471103ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄         |     9\n  7.733247ms  | ▄▄▄▄▄▄▄▄                                    |     2\n  7.995391ms  | ▄▄▄▄▄▄▄▄                                    |     2\n  8.257535ms  | ▄▄▄▄▄▄▄▄▄▄▄▄                                |     3\n  8.650751ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                        |     5\n  9.175039ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ |    11\n  9.699327ms  | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                     |     6\n  10.223615ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                            |     4\n  10.747903ms | ▄▄▄▄                                        |     1\n  11.272191ms | ▄▄▄▄                                        |     1\n  11.796479ms |                                             |     0\n  12.320767ms |                                             |     0\n  12.845055ms |                                             |     0\n  13.369343ms |                                             |     0\n  13.893631ms | ▄▄▄▄                                        |     1\n  14.417919ms | ▄▄▄▄                                        |     1\n  14.942207ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                        |     5\n  15.466495ms |                                             |     0\n  15.990783ms | ▄▄▄▄                                        |     1\n  16.515071ms |                                             |     0\n  17.301503ms |                                             |     0\n  18.350079ms |                                             |     0\n  19.398655ms | ▄▄▄▄                                        |     1\n  20.447231ms | ▄▄▄▄▄▄▄▄                                    |     2\n  21.495807ms | ▄▄▄▄                                        |     1\n  22.544383ms |                                             |     0\n  23.592959ms |                                             |     0\n  24.641535ms | ▄▄▄▄                                        |     1\n  25.690111ms | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                            |     4\n  26.738687ms | ▄▄▄▄                                        |     1\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fdnstrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredsift%2Fdnstrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fdnstrace/lists"}