Skip to content

Repository files navigation

FastNet 0.1.0 [ALPHA-2026-09] — Ultra-Fast Native Network Engine for Java

Status Java Platform License: MIT JitPack


⚡ Ultra-fast asynchronous networking for the FastJava ecosystem.

FastNet is a low-latency transport engine for telemetry, game servers, crawlers and real-time services. It exposes a compact asynchronous API today and provides a clear native boundary for WinSock2, IOCP and direct-memory ring buffers on Windows.

Run the TCP Loopback Demo | Run the UDP Benchmark


Quick Start

import fastnet.FastNet;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class Example {
    public static void main(String[] args) {
        FastNet.sendUdp("127.0.0.1", 9999,
                        ByteBuffer.wrap("telemetry".getBytes(StandardCharsets.UTF_8)))
                .thenAccept(bytes -> System.out.println("Sent bytes: " + bytes));
    }
}

Table of Contents


Why FastNet?

Standard blocking networking creates thread pressure and makes high-frequency services pay for unnecessary copies and polling:

  • Thread exhaustion: One blocking connection per worker does not scale cleanly for burst traffic.
  • Buffer copies: Heap-to-native transitions add latency to telemetry and packet pipelines.
  • Polling overhead: Application loops waste CPU while waiting for kernel I/O completion.

FastNet addresses this with a transport-first design:

  • Asynchronous completion: TCP and UDP operations return futures instead of blocking application threads.
  • Direct-buffer boundary: Payloads can be supplied as ByteBuffer values without changing caller state.
  • Native-ready transport: WinSock2 and IOCP can replace the portable fallback behind the same API.

Features

  • ⚡ Asynchronous TCP and UDP: Connect and send without a polling loop in application code.
  • 📦 Direct buffer support: Submit heap or direct ByteBuffer payloads without mutating them.
  • 🪟 Windows native path: Designed for WinSock2, IOCP and kernel completion events.
  • 🔗 Ecosystem ready: Integrates naturally with FastDNS resolution and FastTLS security.

Real-World Scenarios

  • Live telemetry: Send compact UDP metrics from a sensor or game loop.
  • Game servers: Establish low-latency TCP control channels and UDP state updates.
  • Web crawling: Resolve endpoints with FastDNS and submit concurrent HTTP work.
  • Secure services: Place FastTLS directly above the transport boundary.

Performance Benchmarks

FastNet includes a local UDP benchmark to expose transport overhead before the native IOCP backend is enabled.

Metric / Transport Type Current Java Fallback Native Target
UDP submission Measured by benchmark IOCP / zero-copy
TCP connection Asynchronous NIO Native WinSock2
Telemetry payload Direct-buffer ready Ring-buffer DMA

The benchmark measures the portable Java path on the local machine. Native latency figures are reported only after IOCP integration.


Measured Benchmark Run

The optimized local telemetry benchmark completed 100 UDP packets in 28,968 ms on this Windows workstation; the previous per-call channel setup measured 77,006 ms, so channel reuse reduced this run by about 62%.

run-benchmark.bat -> fastnet.UdpThroughputBenchmark

Native IOCP and zero-copy measurements must be collected separately after the Windows backend is enabled.


API Quick Reference

Method Description
Method Description
-------- -------------
connect(host, port) Opens an asynchronous TCP connection.
sendUdp(host, port, payload) Sends a direct or heap ByteBuffer asynchronously.

Technical Examples & Hero Demos

Case Java Example Launcher Description
TCP Telemetry Channel TcpLoopbackDemo.java run-demo.bat Establishes a local control channel and receives a telemetry response.
UDP Throughput UdpThroughputBenchmark.java run-benchmark.bat Measures repeated UDP submissions for a packet pipeline.

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>FastNet</artifactId>
    <version>0.1.0</version>
</dependency>
</dependencies>

Option 2: Gradle (via JitPack)

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

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

Option 3: Direct Download (No Build Tool)

Download the latest FastNet JAR from the GitHub releases page.


Documentation


Platform Support

Platform Status
Windows 10/11 x64 Native backend 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 network engine for Java — asynchronous TCP/UDP transport with zero-copy buffers, WinSock2/IOCP integration, and low-latency telemetry.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages