Giter Site home page Giter Site logo

node-io-uring's Introduction

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 (libuv/libuv#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:

  • Only 32 read/write requests may be in-flight at a time. Easily fixed.
  • Error checking is minimal, overall code quality is not great. Easily fixed.
  • No fsync support.
  • position (the file position) must be specified and must not be -1; unlike Node.js' fs methods, "current position" (seeking) operations are not supported. This can be mostly fixed by calling lseek(2) before and after the io_uring operation, but the fd cursor position update will not be atomic. (That is unlikely to be a problem for Node.js.)
  • fd must support read_iter/write_iter -- it cannot be a pipe such as stdin, stdout, stderr or a fifo. This is a restriction imposed by io_uring that cannot be avoided.

node-io-uring's People

Contributors

zbjornson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.