Update on Eio (effects-based direct-style IO for OCaml 5)

With Eio 0.10 just released, it’s time for another update! Since the above post (which was for Eio 0.5), some of the bigger changes are:

  • A new eio_posix backed for Unix-type systems provides much better performance than the old libuv one. Removing libuv has also made it safe to share file-descriptors between domains, so you can now accept a connection with one domain and handle it with another, for example.

  • There is now an API for spawning sub-processes.

  • Networking changes include better support for datagram sockets and the new Eio.Net.run_server convenience function.

  • Many of the data-structures (promises, conditions, semaphores and synchronous streams) are now lock-free, making them faster to use across multiple domains.

  • It is safe to handle signals in Eio now that Eio.Condition.broadcast is lock-free (signal handlers can’t take locks, since they may have interrupted the thread holding the lock). Though note that reliable signal handling on OCaml 5 requires OCaml#12253 to be fixed too.

  • Fiber.fork_seq provides an easy way to create generator functions.

  • Eio now supports domain-local-await, which allows sharing e.g. kcas data-structures across Eio and Domainslib domains.

  • Error handling has been improved. You can now add extra context information to errors (e.g. an error opening a missing file will now include the path of the file). You can also choose how specific to be: e.g. you can catch all IO errors, all network errors, or all connection reset errors.

  • There are also some experimental backends under development:

    • eio_solo5 is for MirageOS unikernels.
    • eio_js is for browsers.
    • eio_windows is for Windows - see #125 if you’d like to help out.

A more detailed list of changes can be found in the release notes.

Eio’s README.md provides an introduction to most of the features.

If you’d like to get involved, the new HACKING.md document explains the structure of the code for people who want to contribute to Eio, and there are regular Eio developer meetings for anyone who wants to get involved.

25 Likes