zbjornson / node-io-uring

Prototype using io_uring for true async fs I/O in libuv/Node.js
42 stars 4 forks source link

io_uring is a new I/O interface in the Linux 5.1 kernel that allows for efficient, async I/O. See intro at http://kernel.dk/io_uring.pdf.

This repo has proof-of-concept read(), readFile(), write() and writeFile() implementation replacements for Node.js. They're not complete drop-ins but are sufficient for benchmarking and testing.

I'm planning to polish up this module soon, and expand it to expose all io_uring functionality since it's unlikely that libuv or Node.js would be reasonably able to do so. I'm also not sure when basic support for io_uring will land in Node.js (https://github.com/libuv/libuv/pull/2322).

const iouring = require("iouring");
iouring.read(fd, dest, offset, len, position, (err, bytesRead, dest) => { });
iouring.write(fd, src, offset, len, position, (err, bytesWritten, dest) => { });
iouring.readFile(path, (err, buff) => { });
iouring.writeFile(path, data, (err) => { })

The signatures are the same as Node.js' fs functions.

Current limitations: