Eio Digest #1 (September 2023)

As we’re bracing towards an update to Eio 1.0 after ICFP (famous last words, just kidding :D), the team is happy to present updates on Eio and friends. We hope to carry this out on monthly or bi-monthly basis, in line with the precedent set by Multicore Monthlies, the Platform Newsletter and others.

For the uninitiated, Eio is a direct-style concurrency library for OCaml 5 and beyond. Eio leverages effect handlers for non-blocking IO, and at the same time offers advantages such as enhanced support for backtraces and being able to write concurrent code in direct-style.

Additionally, Eio offers fast native backends for various operating systems when available, such as io_uring for Linux. Eio is conceived to be a replacement for existing monadic concurrency libraries such as Lwt.

Eio 0.12 was released not long ago. The pending tasks for Eio 1.0 are being tracked at Eio#338.

Before going on with detailed updates, I’d like to take a moment to thank all contributors and users for spending their time on Eio. Without their collective efforts, there is no way we could be as far in the development of Eio as we are. If you’re interested in contributing or testing we’d be more than happy to welcome you to the community!


Eio has undergone significant developments and improvements in the past few months. Notably, it replaces the OCaml object system with polymorphic variants to represent OS resources, thereby making code more accessible. Eio also boasts various backends, including a fast native IO backend for Linux’s io_uring and a generic POSIX backend, while also exploring possibilities for macOS and Windows support.

Moreover, Eio is making strides in JavaScript interoperability, aiming to target browser applications. The latest release introduces a resource pool, akin to Lwt_pool, and anticipates support for custom events with the meio CLI tool. Quite a few applications have started migrating to Eio, including Irmin, Wayland, ocaml-grpc, OCaml CI’s solver service and more, expanding Eio’s utility across diverse domains.

Replacing objects with variants

PR: Replace objects with variants by talex5 · Pull Request #553 · ocaml-multicore/eio · GitHub

Originally, Eio’s capabilities were encoded using the OCaml object system. However, as objects in OCaml are not a widely used feature, there was concern from the community that reliance on the object system would hinder wider adoption of Eio. As a result of this feedback, Eio now uses polymorphic variants to serve the same function as objects did previously.

Polymorphic variants are better understood by most OCaml practitioners and we hope that this change will enable more users to adopt Eio. Very little code is expected to break as a result, and this change will be made available in other libraries built with Eio soon.


One of the goals of Eio is to provide fast native IO backends for major operating systems. It is for this reason that we started with a backend for io_uring, Linux’s state-of-the-art, high-performance I/O API. We eventually added a libuv backend (through Luv), which allowed portability across multiple operating systems, vis-à-vis Linux, MacOS, and Windows. Unfortunatley it also caused several problems, and we ended up replacing it with eio_posix.

Eio_posix is a generic POSIX backend, using ocaml-iomux. The Windows backend is functional (pun intended), with more improvements being added. At some point, we may rethink a Grand Central Dispatch backend and IO Completion ports backend for MacOS and Windows respectively.

Javascript Interop

PR: https://github.com/ocaml-multicore/eio/pull/405

Having talked about backends for major operating systems, one cannot ignore browsers, which are getting increasingly common. We have a WIP browser backend for enabling Eio to target Javascript (and Jsoo) applications. This is a promising avenue that opens up possibilities for
Lwt based libraries that use Jsoo to migrate to Eio.

Furthermore, eiojsoo shows some interesting examples of Eio + Js_of_ocaml in action.

Pool and Lazy

Pool: Add Eio.Pool by talex5 · Pull Request #602 · ocaml-multicore/eio · GitHub
Lazy: Add Eio.Lazy by talex5 · Pull Request #609 · ocaml-multicore/eio · GitHub

The latest release of Eio provides a pool. This is similar to Lwt_pool, helpful for managing a collection of resources. For instance, it’s possible that maintaining a pool of expensive resources such as domains or database connections is more memory and resource efficient than the alternative.

The latest release also includes a fiber-safe lazy module (Eio.Lazy) that allows lazy values to be forced concurrently from multiple fibers.

Custom Events (meio)

OCaml 5.1 will have support for user-defined custom events, extending the ring-buffer based event tracing system. meio is a tokio-console style CLI tool for real time monitoring of Eio programs. The hope is that it will make debugging Eio programs a more pleasant experience. The tool is currently experimental. We hope to have an initial release scheduled for after OCaml 5.1 is out.

Splitting Eio Core

Issue: Split out fiber core · Issue #544 · ocaml-multicore/eio · GitHub

Something we discussed in our developer meeting is potentially splitting out the core Fiber as a separate library. A potential use-case of this might be formally verifying Eio Fibers. While no decisions have been made on this yet, we’re interested to know if this could be useful for anything not mentioned above.


Several applications have started harnessing the power of Eio. Below are some we know of:


In a first for the library, Irmin has a shiny new Eio backend. Irmin, the distributed database (which is used as storage system for Tezos, amongst others), has started migrating to Eio with the eventual goal of supporting multicore Irmin. Stay tuned to hear more about this from the Irmin team.


Eio 0.12 added support for SCM_RIGHTS. This allowed conversion of the ocaml-wayland library to Eio. That, in turn, allowed an Eio port of wayland-proxy-virtwl. These ports should be merged and released soon.


Repository: GitHub - dialohq/ocaml-grpc: gRPC library for OCaml

ocaml-grpc now includes an Eio mode. @quernd reported that it has been deployed in their production systems and is working quite well.

Solver Service

OCaml CI’s solver service is now powered by Eio. This has also made the solver service multicore. The Lwt version is still active because we are still debugging some performance issues with the Eio version.


Available at: GitHub - TheLortex/eio-solo5: ah yes, effect handlers in unikernels

We’re committed to preserving Eio’s compatibility with the larger Mirage ecosystem. With that in mind, eio-solo5 is a small experiment that demonstrates Dream running over Eio and Mirage libraries.


PR: https://github.com/NixOS/nixpkgs/pull/230270

Thanks to @toastal, Eio and sub-packages are now available at Nix packages.

Call to Action


The good news is that we have a functional Windows backend for Eio (shout-out to @patricoferris). Not so good news is that we haven’t done an awful lot of stress testing on it. If you are running Eio on Windows, we’re eager to hear what works, and more importantly what doesn’t. We intend for the Windows backend to be a first class citizen, in alignment with the overarching objective of upholding Windows as a primary platform within the OCaml ecosystem. That means resolving bugs and improving workflows, so please let us know about your experience using Eio on Windows.

Learn More

Our README offers a comprehensive getting-started guide for Eio. For the more curious readers wanting additional information:

  • Lwt to Eio tutorial at ICFP 2023: Thomas Leonard (@talex5) and Jon Ludlam (@jonludlam) are running a tutorial at ICFP on migrating Lwt applications to Eio. Materials are available here.
  • Awesome multicore OCaml: awesome-multicore-ocaml is a collection of all resources related to Multicore and effect handlers.