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 ;
server.;
Client Usage
// Create a client with connection pooling
var client ;
// Send request and await response
var response ;
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
| Metric | Myra Transport | Netty epoll | Improvement |
|---|---|---|---|
| Throughput | 2.1M msg/s | 0.8M msg/s | 2.6x |
| p50 Latency | 12µs | 28µs | 2.3x |
| p99 Latency | 35µs | 120µs | 3.4x |
| p99.9 Latency | 85µs | 450µs | 5.3x |
| Alloc/op | 0 bytes | ~200 bytes | ∞ |
Requirements
- Java 25+ with
--enable-previewand--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
express.mvp
myra-transport
0.1.0