NameBench

repository·master·Indexed 42 days ago

https://github.com/catap/namebench

A DNS server benchmarking tool that compares DNS server performance. It provides a GUI and a CLI to test specific IP addresses or groups of servers (such as system, ISP, or global) using configurable query counts, timeouts, and threading.

Tokens
3.5K
Snippets
17
Records
23
Agent score
48%

What's inside NameBench

  1. Install and run namebench

    master

    namebench requires Python 2.4 - 2.6. On Mac OS X or Linux, Python is typically built-in. Otherwise, install it from python.org.

    To run a standard benchmark with the default settings, execute the script without arguments:

    ./namebench.py
  2. Use the namebench command-line interface

    master

    namebench provides both a graphical user interface (GUI) and a command-line interface (CLI).

    • Default behavior: On Mac OS X and Windows, the GUI is used by default.
    • Force CLI: To disable the GUI and force the command-line interface, use the -x or --no_gui flag.
    ./namebench.py -x
  3. Overview of dnspython

    master

    dnspython is a DNS toolkit for Python that supports almost all record types. It provides two levels of access:

    1. High-level access: Classes that perform queries for data of a given name, type, and class, returning an answer set.
    2. Low-level access: Classes that allow direct manipulation of DNS zones, messages, names, and records.

    It supports queries, zone transfers, dynamic updates, TSIG authenticated messages, and EDNS0.

  4. Httplib2 Feature Overview

    master

    Httplib2 is a comprehensive HTTP client library with the following capabilities:

    • HTTP/HTTPS Support: HTTPS is available if the Python socket module was compiled with SSL support.
    • Keep-Alive: Supports HTTP 1.1 Keep-Alive to reuse connections for multiple requests.
    • Authentication: Supports Digest, Basic, and WSSE authentication over HTTP and HTTPS.
    • Caching: Supports a private cache using Cache-Control headers, ETag, and Last-Modified validators.
    • Methods: Handles all HTTP request methods (not just GET and POST).
    • Redirects: Automatically follows 3XX redirects on GET requests.
    • Compression: Automatically handles deflate and gzip compression.
    • Lost Update Support: Automatically adds ETags back into PUT requests for previously cached resources.
  5. Access Answer objects as sequences

    master

    In recent versions, Answer objects support the Python sequence protocol, allowing you to iterate over or slice the underlying rrset directly.

    # The following are equivalent:
    for a in answer
    for a in answer.rrset
    
    answer[i] == answer.rrset[i]
    answer[i:j] == answer.rrset[i:j]
  6. Quick start with Graphy LineChart

    master

    To create a basic line chart using the Google Chart API backend, import google_chart_api from graphy.backends. You can pass your data directly to the LineChart constructor and then configure chart elements like chart.bottom.labels to add context. Use chart.display.Url(width, height) to generate a URL for displaying the chart.

    from graphy.backends import google_chart_api
    monthly_rainfall = [3.2, 3.2, 2.7, 0.9, 0.4, 0.1, 0.0, 0.0, 0.2, 0.9, 1.8, 2.3]
    months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split()
    chart = google_chart_api.LineChart(monthly_rainfall)
    chart.bottom.labels = months
    print chart.display.Url(400, 100)
  7. Run namebench CLI to benchmark DNS servers

    master

    The namebench CLI tool is used to compare DNS server performance. To run a benchmark, you must specify which DNS servers to test using the -s flag or by providing IP addresses as positional arguments.

    Common usage patterns include:

    • Testing all available DNS servers: namebench.py -s all
    • Testing specific groups: namebench.py -s preferred,isp or namebench.py -s system
    • Testing a specific global server plus others: namebench.py -s global 8.8.8.8
    • Testing only specific IP addresses: namebench.py 8.8.8.8 10.0.0.1

    For a full list of options, use namebench.py -h.

    # Test best available DNS servers
    namebench.py -s all
    
    # Only test current system DNS servers
    namebench.py -s system
    
    # Benchmark just these two servers
    namebench.py 8.8.8.8 10.0.0.1
  8. Troubleshoot common namebench errors

    master

    thread.error: can't start new thread

    This occurs when you are using too many threads. Reduce the thread count using the -j flag. Example fix:

    ./namebench.py -j8

    unhealthy: TestWwwGoogleComResponse <class 'dns.exception.Timeout'>

    This indicates the specified nameserver was too slow to answer. If all nameservers are timing out, increase the general timeout using the -Y flag. Example fix:

    ./namebench.py -Y 4
  9. Specify custom nameservers for testing

    master

    You can test specific IP addresses instead of the default set by either adding the IPs directly to the command line or by editing the namebench.cfg file.

    To test specific IPs via the CLI:

    ./namebench.py 10.0.0.1 192.168.0.1