dns-benchmark

dnspy - DNS Server Performance Testing Tool

English 中文

Project Overview

DNS services in many regions are often hijacked by ISPs, injecting various advertisements and causing privacy concerns. To ensure a safe and reliable internet experience, we need to find trustworthy DNS services.

There are not many similar tools available. The well-known DNSJumper only supports Windows and has limitations such as limited data sources and single evaluation dimensions.

Therefore, we developed this tool to test available DNS servers and their performance in your local network environment. This tool is written in Golang and supports cross-platform use on Windows, macOS, and Linux.

Additionally, we provide a visual data analysis dashboard that allows you to easily understand which DNS servers are available 😊

Pro Tip: Click on the bar charts in the data analysis dashboard to copy server addresses.

Usage Flow: Follow the guide below to download the testing tool and obtain a JSON file with test results, then open the data analysis dashboard website to upload and analyze the data. The website does not store any data.

Data Analysis Dashboard Preview

Data Analysis Dashboard Preview

Data Analysis Dashboard (with Sample Data)

Usage

dnspy

1. Download the Tool

From the releases page of this repository, download the corresponding dnspy-* file according to your system architecture.

For example: macOS users with M-series processors should download the dnspy-darwin-arm64 file.

2. Prepare Testing Environment

Important Notice: You must disable all proxy software’s Tun mode and virtual network card mode, otherwise it will severely affect the accuracy of test results.

3. Run the Test

Rename the downloaded file to dnspy (dnspy.exe on Windows), open a terminal, navigate to the directory containing the file, and execute the following commands:

unset http_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY ALL_PROXY
./dnspy

Follow the prompts to start testing.

4. Testing Instructions

The program uses multi-threading mode by default to speed up testing.

Performance Requirements: The default parameters (10 threads) require at least 1 MB/s network bandwidth (both upload and download) and at least a 4-core processor.

If your network or processor performance is insufficient, it may lead to inaccurate test results. It is recommended to reduce the number of threads using the -w parameter.

After the test is complete, the results will be output to the current directory with a filename format like dnspy_result_2024-11-07-17-32-13.json.

5. View Results

Following the program prompt, enter Y or y or simply press Enter, and the program will automatically open the data analysis dashboard website. Click the “Read Analysis” button in the upper right corner of the website, select the JSON file just generated, and you can view the visualized test results.

Available Parameters

~> dnspy -h

Usage Examples:

  dnspy
    Start testing directly using built-in world domains

  dnspy -s 114.114.114.114
    Test a single server

  dnspy dnspy_benchmark_2024-10-22-08-18.json
    Visualize and analyze test results

Parameter Description:
  -c, --concurrency int   Number of concurrent queries per test
                          (default 10)

  -d, --domains string    File path storing domain names for batch testing
                          Must be a file path relative to current program working directory
                          File format: one domain per line
                          If not modified, uses built-in 10000 popular domains
                          (default "@sampleDomains@")

  -t, --duration int      Duration of each test in seconds
                          (default 10)

  -f, --file string       File path storing server data for batch testing
                          Must be a file path relative to current program working directory
                          File format: one server address per line

  -g, --geo string        Independent feature: Query IP or domain geolocation using GeoIP database

      --json              Output logs in JSON format

  -l, --level string      Log level
                          Options: debug, info, warn, error, fatal, panic
                          (default "info")

      --no-aaaa           Do not resolve AAAA records for each test (no IPv6 testing)

      --old-html          Deprecated, not recommended
                          Recommended new way: Program outputs data JSON file first, follow prompts to view visual analysis
                          Next time you need to view, directly open JSON file with the program
                          This parameter uses the old way to output a single HTML file to the same directory as data JSON
                          Can be opened by double-clicking

  -o, --output string     Output file path for results
                          Must be a file path relative to current program working directory
                          If not specified, outputs to dnspy_result_<current time>.json in current working directory

      --prefer-ipv4       Prefer IPv4 addresses when converting DNS server domain names to IP addresses
                          (default true)

  -s, --server strings    Manually specify server(s) to test, supports multiple

  -w, --worker int        Number of DNS servers to test simultaneously
                          (default 20)

Compilation

Compilation Environment Requirements

'GOOS' is not recognized as an internal or external command,
operable program or batch file.

Compilation Steps

1. Clone This Repository

git clone https://github.com/xxnuo/dns-benchmark.git
cd dns-benchmark/dnspy

2. Update Data Files (Optional)

make update

3. Configure Dependencies

make configuration

4. Build

make build

After compilation is complete, the generated executable file will be located in the current directory.

License

This project is open source. Contributions and suggestions are welcome.