ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
558 stars 72 forks source link

Replace libuv #434

Closed talex5 closed 1 year ago

talex5 commented 1 year ago

libuv is not suitable for an Eio backend. Problems include:

The main reason to use it was to get Windows support for free. However, that doesn't fully work (https://github.com/aantron/luv/issues/142) and we hope to provide a native Windows backend instead.

On other systems, we now use the much simpler Eio_posix backend.

patricoferris commented 1 year ago

In case it is useful I have a mostly working (but needs more testing and of course reviewing!) kqueue-based backend https://github.com/patricoferris/eio/tree/kqueue/lib_eio_kqueue. I'm a little more confident in this backend for macOS than GCD at the moment and we might get BSDs out of it too (although kqueue implementations vary between them all it seems)

tmcgilchrist commented 1 year ago

Out of interest @patricoferris what is the issue with using macOS GCD? Are there technical limitations or is it a matter of developer time?

patricoferris commented 1 year ago

Out of interest @patricoferris what is the issue with using macOS GCD? Are there technical limitations or is it a matter of developer time?

Good question! I've been hacking away without really completing both a kqueue-based backend and a GCD backend whilst reading quite a bit about both, and here's my opinionated thoughts on that matter:

In the long run, on macOS, I think we'll benefit from being in total control of the OS resources ourselves. We can use kqueues for networking and then do some systhread worker pool magic for File I/O, this way we only have to fight with ourselves and not some other library too! I don't think the GCD backend is completely dead, but I think the kqueue support in Eio_posix is probably the first most important thing to do :))

talex5 commented 1 year ago

Status update: we now have an Eio_posix backend (#448) that fixes these issues (though there are a few things to improve: #456). Eio_luv is now only used on Windows.

samwgoldman commented 1 year ago

we hope to provide a native Windows backend instead

The Flow team at Meta would be interested in this. We current use Lwt but have run into a number of Windows-related issues, so we're looking closely at Eio as we move to OCaml 5. I'm happy to help contribute to this.

avsm commented 1 year ago

@samwgoldman, glad to hear it! Just to help scope out your use of Windows here, are you primarily interested in a CLI to generate a flow.exe, or other Win32 API integration points?

avsm commented 1 year ago

The direct issue to supporting Windows is in https://github.com/ocaml-multicore/eio/issues/125, so best to switch discussion there from this one about libuv, @samwgoldman.