dnspyre DNS Benchmarking Tool

repository·master·Indexed 43 days ago

https://github.com/tantalor93/dnspyre

A high-performance command-line DNS benchmarking tool used to stress test DNS servers across various protocols, including UDP, TCP, DoT (DNS over TLS), DoH (DNS over HTTPS), and DoQ (DNS over QUIC). It supports custom query types, load control via concurrency and rate limiting, and result visualization through CLI histograms or exported image formats (png, svg, pdf).

Tokens
11.5K
Snippets
69
Records
79
Agent score
55%

What's inside dnspyre

  1. Overview of dnspyre DNS benchmarking

    master
    dnspyre is a command-line DNS benchmark tool designed to stress test and measure the performance of DNS servers. It is cross-platform and runs on MacOS, Linux, and Windows. Originally forked from dnstrace, it has been rewritten to provide enhanced functionality for performance measurement.
  2. Overview of dnspyre

    master
    dnspyre is a high-performance command-line DNS benchmark tool designed to stress test and measure the performance of DNS servers. It supports multiple protocols including plain DNS (UDP/TCP), DNS over TLS (DoT), DNS over HTTPS (DoH), and DNS over QUIC (DoQ). It is compatible with MacOS, Linux, and Windows.
  3. How dnspyre works

    master

    dnspyre is a DNS server benchmarking tool that spawns a configured number of concurrent worker threads. Each worker thread sends DNS queries for specified domains. The benchmark execution terminates when one of the following conditions is met:

    1. A configured number of domain query repetitions is reached (using the --number flag).
    2. A specified benchmark duration elapses (using the --duration flag).
    3. The process is interrupted by a SIGINT signal.
  4. Customize DNS benchmarks with dnspyre

    master

    dnspyre provides extensive options to customize how you benchmark DNS servers. Key capabilities include:

    • Protocol Support: Benchmark using UDP, TCP, DoT (DNS over TLS), DoH (DNS over HTTPS), and DoQ (DNS over QUIC).
    • Query Types: Specify query types such as A, AAAA, CNAME, HTTPS, etc., using the --type option.
    • Load Control:
      • Control the number of parallel queries and connections using --number and --concurrency.
      • Set a specific benchmark duration using --duration.
      • Simulate uneven random load from high-volume resources using the --probability option.
    • Result Visualization:
      • Generate CLI histograms using the --plot option.
      • Export results as boxplots, histograms, or line graphs in various image formats (png, svg, pdf) using the --plotf option.
  5. How DNS cookies work in dnspyre

    master

    When the --cookie flag is enabled, dnspyre manages cookies per concurrent worker. Each worker generates a unique 8-byte Client Cookie which is reused for all subsequent requests made by that specific worker:

    1. Initial Request: Contains only the Client Cookie.
    2. Subsequent Requests: Includes the concatenated Client + Server Cookie (provided the server returned a Server Cookie in a previous response).

    This mechanism allows dnspyre to maintain stateful cookie exchanges across multiple queries within a single worker's lifecycle.

  6. Configure DNS request timeouts

    master

    dnspyre allows you to configure specific timeouts for outgoing DNS requests using CLI flags. These timeouts control different stages of the network lifecycle:

    • --connect: Sets the timeout for establishing a connection to a DNS server.
    • --write: Sets the timeout for writing a request to a DNS server.
    • --read: Sets the timeout for reading a response from a DNS server.
    • --request: Sets the overall timeout covering the entire lifecycle (connection, sending the request, and reading the response).

    Timeout values should be provided as duration strings (e.g., 100ms, 1s, 10s).

    dnspyre --request 100ms --duration 10s --server 'quic://dns.adguard-dns.com' https://raw.githubusercontent.com/Tantalor93/dnspyre/master/data/1000-domains
  7. Generate benchmark results in JSON format

    master

    To facilitate automatic processing of benchmark results, use the --json flag. This instructs dnspyre to output the results as a structured JSON object instead of the default text format.

    For better readability during manual inspection, you can pipe the output to jq to produce pretty-printed JSON.

    # Basic JSON output
    dnspyre --duration 5s --server 8.8.8.8 google.com --json
    
    # Pretty-printed JSON output using jq
    dnspyre --duration 5s --server 8.8.8.8 google.com --no-distribution --json | jq '.'
  8. Configure per-worker rate limiting with --rate-limit-worker

    master

    Use the --rate-limit-worker flag to set a rate limit that applies separately to each individual concurrent worker. Unlike the global --rate-limit flag, this ensures that every worker spawned by the --concurrency (or -c) flag maintains its own independent query-per-second limit, resulting in more predictable and even load generation across all workers.

    dnspyre --duration 10s -c 10 --rate-limit-worker 1 --server '8.8.8.8' google.com
  9. Randomize DNS queries using the --probability flag

    master

    When running dnspyre in concurrent mode (--concurrency > 1), all workers generate identical queries by default. This can lead to unrealistic results because most queries will be served from the cache.

    To simulate real-life scenarios and prevent cache-heavy results, use the --probability flag with a value less than 1. This randomizes the queries fired by each concurrent thread. For example, setting --probability 0.33 ensures that each thread uses roughly every third hostname from your data source, creating a more arbitrary and realistic random load.

    dnspyre --duration 30s -c 10 --server 8.8.8.8 -t A -t AAAA https://raw.githubusercontent.com/Tantalor93/dnspyre/master/data/1000-domains --probability 0.33