Skip to content

zth1337/panama-nvme

Repository files navigation

🚀 PanamaNVMe: Extreme Performance NVMe Driver in Java

Java Version OS License

PanamaNVMe is a purely userspace NVMe driver written entirely in Java using Project Panama (Foreign Function & Memory API).

It brings the architectural principles of SPDK (Storage Performance Development Kit) directly to the Java ecosystem. By completely bypassing the Linux kernel, system calls, and hardware interrupts, we communicate directly with the PCIe controller via IOMMU and DMA.

The result? Millions of IOPS, CPU-cache-level latencies, and zero allocations (Zero-GC) on the hot I/O path.


🔥 Features

  • 🛑 Zero Kernel Overhead: No read(), write(), or epoll. Complete bypass of the Linux VFS and block layer.
  • 🗑️ Zero-GC I/O Path: Buffers live Off-heap (HugePages), and command tracking relies entirely on primitives. The Garbage Collector sleeps while your SSD melts.
  • 🧵 Thread-Per-Core (Shared-Nothing): Each worker thread gets its own exclusive hardware Queue Pair. No mutexes, no CAS operations, no thread parking.
  • 🚪 Doorbell Batching: We build batches of commands directly in RAM and ring the PCIe Doorbell register just once per batch. Pure magic that saves hundreds of nanoseconds per I/O.
  • 🔄 Busy-Spin Polling (Run-to-Completion): Threads never sleep waiting for OS interrupts. They spin in a tight loop (Thread.onSpinWait()), instantly grabbing hardware completions.

📊 Benchmarks (JMH)

Performance is the primary goal of this driver. We use JMH (Java Microbenchmark Harness) to measure raw IOPS and validate our Zero-GC claims. image

🛠️ System Requirements

Since this is a hardcore systems driver that talks directly to hardware, you will need:

  1. Linux OS (relies on the vfio-pci subsystem).
  2. Java 22+ (for the stable FFM API).
  3. IOMMU enabled in the kernel (intel_iommu=on or amd_iommu=on in GRUB).
  4. HugePages configured (e.g., sysctl vm.nr_hugepages=1024).
  5. Root privileges (or properly configured udev rules for /dev/vfio/*).

⚠️ WARNING: The driver takes exclusive control of the disk! DO NOT use this on your OS boot drive or any disk containing valuable data. The file system is entirely ignored; we write raw bytes directly to sectors.

About

Zero-GC, Lock-Free & Direct NVMe driver for Java using Project Panama. Bypasses the OS kernel for millions of IOPS.

Topics

Resources

License

Stars

Watchers

Forks

Contributors