Git Product home page Git Product logo

fs2-io_uring's Introduction

fs2-io_uring

A library implementing FS2 I/O APIs for Scala Native via the io_uring Linux kernel system call interface. The provided implementations are drop-in replacements that can be used to power http4s Ember, Skunk, and Rediculous.

At its heart fs2-io_uring is an I/O-integrated runtime for Cats Effect. The library is unique in how close to the bare-metal it is and thus how deeply it integrates with kernel I/O APIs. The implementation is literally Cats Effect sharing memory with and talking directly to the kernel: no JDK, no JNI, no overhead. Nearly all system calls are asynchronous, cancelable, and efficiently submitted in batches via the io_uring API. Even cancelation is async and fully-backpressured.

Usage

libraryDependencies += "com.armanbilge" %%% "fs2-io_uring" % "0.2.0"

You must also install liburing. For performance, I strongly recommend using static linking, for example:

nativeConfig ~= { c =>
  c.withCompileOptions(c.compileOptions :+ "-I/home/linuxbrew/.linuxbrew/include")
    .withLinkingOptions(c.linkingOptions :+ "/home/linuxbrew/.linuxbrew/lib/liburing.a")
}

To use fs2-io_uring in an application, you should replace IOApp with UringApp. For tests, you should override the runtime:

override def munitIORuntime = UringRuntime.global

Finally, you can import from fs2.io.uring.implicits._ to get an implicit io_uring-backed Network into scope. You may also directly construct instances of:

  • UringNetwork
  • UringSocketGroup
  • UringUnixSockets

Future releases will add support for datagram sockets and file I/O.

Versioning and compatibility

Because this library implements FS2 sealed interfaces, but is released and versioned independently, it is not covered by FS2's usual guarantee of backwards-binary-compatibility. Specifically, updating your FS2 version may cause fs2-io_uring to break.

Therefore, you should not add it as a dependency in libraries. Instead, make sure to expose the Network and UnixSockets constraints of your library, so that users can substitute the fs2-io_uring implementations of these APIs in their applications.

fs2-io_uring's People

Contributors

armanbilge avatar nimble-agar-steward[bot] avatar antoniojimeneznieto avatar mox692 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.