Skip to content

About

⚡ NTP Benchmark Tool: High-performance CLI to benchmark NTP servers. Ranks candidates by response time, latency, and network hops. Features parallel execution, cross-platform support, and detailed logging.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NTP Benchmark Tool

Python Version License Status

A high-performance CLI utility to test, benchmark, and rank public NTP (Network Time Protocol) servers to find the optimal time source for your network configuration.

📊 Demo

C:\> python bestntpserver.py --test

=== Best Server ===
Server: 1.br.pool.ntp.org
NTP response time: 0.004 seconds
Ping time: 4.67 ms
Hops: 7

=== All Results ===
+---------------------+--------------+-----------+------+
|        Server       | NTP Time (s) | Ping (ms) | Hops |
+---------------------+--------------+-----------+------+
|  1.br.pool.ntp.org  |    0.004     |    4.67   |  7   |
|    1.pool.ntp.org   |    0.005     |    5.67   |  7   |
|    2.pool.ntp.org   |    0.006     |    9.00   | inf  |
|    time.apple.com   |    0.006     |    5.33   | inf  |
|  0.br.pool.ntp.org  |    0.006     |    5.67   |  9   |
| time.cloudflare.com |    0.007     |    5.00   |  7   |
...

✨ Features

  • Concurrent Execution: Benchmarks servers in parallel using automated multi-threading optimization based on CPU core count.
  • Smart Ranking: Evaluates via a tuple hierarchy (NTP sync delay > raw hops > raw ping).
  • Cross-Platform: Automatically adapts OS-level networking checks (tracert vs traceroute and ping) for Windows, macOS, and Linux.
  • Robust Parsing: Built-in multi-language ping support (handles time=, tempo=, Zeit=, temps=).
  • Curated Dataset: Includes 29 highly reliable global and regional (Brazil) public NTP IP addresses/URLs.

🚀 Quick Start

git clone https://github.com/reneoliveirajr/ntp-benchmark-tool.git
cd ntp-benchmark-tool
pip install -r requirements.txt
python bestntpserver.py --test

🛠️ Usage

Argument Description
--test Benchmark all configured servers (runs parallel by default).
--server <addr> Benchmark a single specific NTP server address.
--show-servers Output a table of all hardcoded NTP servers.
--sequential Run the benchmark synchronously (disables parallel execution).
--timeout <sec> Customize the network timeout for requests (default: 10).
--workers <num> Override the default thread pool worker limit (default: 5).
--verbose Print trace diagnostic/debug-level logging.

🧠 How it Works

The tool orchestrates asynchronous execution on three fronts per target server and then scores them by a sorted tuple algorithm:

  1. Lowest NTP Response Time: Measures the actual NTP synchronization lag (ntplib). This is the absolute priority determinant for benchmarking time servers.
  2. Fewest Network Hops: Performs an OS-based traceroute. A shorter network path denotes fewer routing points of failure.
  3. Lowest ICMP Ping: Evaluates raw ICMP response time in milliseconds. Acts mainly as a final tiebreaker.

(Note: Failed routes or unreachable endpoints fallback to inf instead of throwing exceptions).

💻 Tech Stack

  • ntplib: Core protocol query client.
  • prettytable: Terminal ANSI ASCII formatting.
  • concurrent.futures.ThreadPoolExecutor: Standard library parallelization.
  • subprocess: OS-level routing commands binding.

📄 License

This project is licensed under the MIT License.

About

⚡ NTP Benchmark Tool: High-performance CLI to benchmark NTP servers. Ranks candidates by response time, latency, and network hops. Features parallel execution, cross-platform support, and detailed logging.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Contributors

Languages