Myra Transport

io_uring-based networking with zero-copy buffer management

Network Layerio_uring2.1M msg/s

Overview

Myra Transport is a high-performance networking layer built on Linux io_uring. It provides true async I/O with zero-copy buffer management, achieving throughput levels previously impossible with traditional Java networking.

Key Features

io_uring Integration

  • True async I/O with kernel submission queues
  • Batched syscalls reducing kernel transitions
  • Zero-copy receive with registered buffers
  • Multishot operations for efficient polling

Zero-Copy Architecture

  • Off-heap buffers via Roray FFM Utils
  • Direct buffer passing between kernel and user space
  • Slice-based message views without copying
  • Reference-counted buffer pools

High Performance

  • 2.1M+ messages/second sustained throughput
  • 12µs p50 latency for round-trip
  • 3x faster than Netty in benchmarks
  • Minimal GC pressure in hot paths

Connection Management

  • Connection pooling with health checks
  • Multiplexed connections for multiple streams
  • Backpressure with flow control
  • Graceful shutdown handling

Quick Example

// Create a high-performance server
var server = MyraServer.builder()
    .port(8080)
    .transport(IoUringTransport.builder()
        .sqeSize(4096)
        .cqeSize(8192)
        .registeredBuffers(true)
        .build())
    .handler(new MessageHandler() {
        @Override
        public void onMessage(Connection conn, ByteBuffer message) {
            // Process with zero-copy access to message data
            var response = processRequest(message);
            conn.send(response);
        }
    })
    .build();

server.start();

Client Usage

// Create a client with connection pooling
var client = MyraClient.builder()
    .address("localhost", 8080)
    .transport(IoUringTransport.create())
    .poolSize(10)
    .build();

// Send request and await response
var response = client.send(request).get();

Architecture

┌──────────────────────────────────────────────────────────┐
│                     Application Layer                     │
├──────────────────────────────────────────────────────────┤
│                    MyraServer / MyraClient               │
├──────────────────────────────────────────────────────────┤
│                    Connection Management                  │
│              (pooling, multiplexing, backpressure)       │
├──────────────────────────────────────────────────────────┤
│                     Buffer Management                     │
│           (off-heap pools, reference counting)            │
├──────────────────────────────────────────────────────────┤
│                    IoUringTransport                       │
│        (SQ/CQ management, registered buffers)            │
├──────────────────────────────────────────────────────────┤
│                  Linux Kernel (io_uring)                  │
└──────────────────────────────────────────────────────────┘

Performance vs Netty

MetricMyra TransportNetty epollImprovement
Throughput2.1M msg/s0.8M msg/s2.6x
p50 Latency12µs28µs2.3x
p99 Latency35µs120µs3.4x
p99.9 Latency85µs450µs5.3x
Alloc/op0 bytes~200 bytes

Requirements

  • Java 25+ with --enable-preview and --enable-native-access
  • Linux 5.1+ (kernel with io_uring support)
  • Recommended: Linux 5.19+ for advanced features

Installation

Gradle (Kotlin DSL)

dependencies {
    implementation("express.mvp:myra-transport:0.1.0")
}

tasks.withType<JavaExec> {
    jvmArgs(
        "--enable-preview",
        "--enable-native-access=ALL-UNNAMED"
    )
}

Maven

<dependency>
    <groupId>express.mvp</groupId>
    <artifactId>myra-transport</artifactId>
    <version>0.1.0</version>
</dependency>