Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastDNS 0.1.0 [ALPHA-2026-09] — Ultra-Fast DNS Resolver for Java

Status Java Platform License: MIT JitPack


⚡ Ultra-fast asynchronous name resolution for the FastJava ecosystem.

FastDNS combines a stable asynchronous API with a local TTL cache for crawlers, service clients, telemetry gateways and socket pools. It uses the portable JDK resolver today while reserving a native Windows DnsQueryEx, DoH and DoT backend for high-concurrency workloads.

Run the DNS Cache Demo | Run the Resolver Benchmark


Quick Start

import fastdns.FastDNS;

public class Example {
	public static void main(String[] args) {
		FastDNS.resolve("example.com")
				.thenAccept(address -> System.out.println("Resolved: " + address));
	}
}

Table of Contents


Why FastDNS?

Synchronous hostname resolution becomes a bottleneck when crawlers, telemetry clients or socket pools open many endpoints:

  • Blocking lookups: A resolver call can hold a worker while the operating system waits for a response.
  • Repeated work: Stable service names are resolved again even when a recent answer is still valid.
  • Connection coupling: Network code becomes harder to scale when resolution and socket setup share a blocking path.

FastDNS addresses this with a small resolver facade:

  • Asynchronous completion: Resolution returns a CompletableFuture for natural fan-out.
  • TTL-aware cache: Successful answers are reused until the caller-selected expiry time.
  • Native-ready providers: DnsQueryEx, DoH and DoT can replace the fallback without changing callers.

Features

  • ⚡ Asynchronous resolution: Resolve many service names without blocking crawler or client workers.
  • 🗃️ TTL-aware cache: Reuse successful answers with a caller-selected lifetime.
  • 🧵 Thread-safe facade: Concurrent lookups share a predictable cache contract.
  • 🪟 Native-ready backend: Designed for Windows DnsQueryEx, DoH and DoT integration.

Real-World Scenarios

  • Web crawling: Resolve thousands of crawler endpoints without blocking worker threads.
  • FastNet startup: Resolve service endpoints before opening socket connections.
  • Microservice clients: Reuse short-lived DNS answers during burst traffic.
  • Telemetry: Avoid repeated resolver work for stable device gateways.

Performance Benchmarks

FastDNS includes a cache demo and a repeated-lookup benchmark to expose resolver overhead before native DnsQueryEx integration.

Metric / Resolution Type Current Java Fallback Native Target
Cached lookup Measured by benchmark Atomic native cache
Cold lookup JDK resolver DnsQueryEx
Secure lookup Provider-dependent DoH / DoT

The benchmark measures repeated local lookups. Native latency and cache figures are reported only after the platform resolver backend is integrated.


Measured Benchmark Run

The optimized local benchmark completed 1,000 cached localhost lookups in 12.25 ms after clearing the cache; in-flight deduplication also prevents duplicate concurrent resolver work for the same hostname:

run-benchmark.bat -> fastdns.ResolverBenchmark

The result is machine-dependent; run the launcher again when comparing TTL, cache or native DnsQueryEx changes.


API Quick Reference

Method Description
Method Description
-------- -------------
resolve(hostname) Resolves a hostname asynchronously using the default TTL.
resolve(hostname, ttlMillis) Resolves and caches with a caller-selected TTL.
clearCache() Removes all cached answers.

Technical Examples & Hero Demos

Case Java Example Launcher Description
Crawler Endpoint Cache DnsCacheDemo.java run-demo.bat Compares the first lookup with a cached service endpoint lookup.
Resolver Cache Throughput ResolverBenchmark.java run-benchmark.bat Measures repeated cached lookups for a high-volume client.

Installation

Option 1: Maven (Recommended)

<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>
<dependencies>
	<dependency>
		<groupId>com.github.andrestubbe</groupId>
		<artifactId>FastDNS</artifactId>
		<version>0.1.0</version>
	</dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
	maven { url 'https://jitpack.io' }
}

dependencies {
	implementation 'com.github.andrestubbe:FastDNS:0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest FastDNS JAR from the GitHub releases page.


Documentation


Platform Support

Platform Status
Windows 10/11 x64 Native DnsQueryEx planned
Linux Java fallback
macOS Java fallback

License

MIT License — See LICENSE for details.


Related Projects


Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

⚡ Ultra-fast native-ready DNS resolver for Java — asynchronous hostname resolution with TTL caching, DnsQueryEx integration, and DoH/DoT-ready service discovery.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages