We just released a new monadic concurrency library called Async.
Async isn’t really new, at least, not within Jane Street. We’ve been using Async for years, and it is now at the heart of almost all the systems we build. Indeed, developers at Jane Street have often bemoaned the fact that they find it painful to do projects at home because they miss Async. If you’re building any kind of code that touches the network, Async is a huge help. That internal demand is part of why we’re releasing Async. Beyond that, so much of our own internal software is built with Async that the lack of a public release for Async made it hard to release anything else.
But we also hope that Async will be directly useful to others. It’s been battle-tested by years of use, dozens of programmers and many applications. If you’re building a networked service in OCaml, Async can be an excellent building block.
That said, it’s still early days for Async outside of our walls. We’ve done almost no work to get Async compiling and working well outside of Linux, for example. There are also a number of improvements that we’ve made inside our walls that haven’t yet made it to the public release branch.
More generally, we’re in the middle of trying to shift around how we manage the public releases of our software. We’ve created a mailing list:
and we’re in the process of moving to using github for managing our external source repositories. We’re hoping that Core and Async and the other associated libraries can become a real foundation for people building production software with OCaml.
I’ll try to do some more blog posts about Async in the coming weeks, but one question that many experienced OCaml-hands might wonder is, how does this relate to the other monadic concurrency library for OCaml, Lwt?
Lwt is by all accounts an excellent piece of software, and we’ve actually stolen a number of good ideas from them over the years. But we decided years back to create our own library rather than use Lwt because there were aspects of the design that we didn’t like. In particular, we think that Async does a better of controlling the concurrency of your program, making it easier to reason about possible race conditions. And we prefer Async’s approach to error handling, which we think does a better job of handling OCaml exceptions. Also, Async is written almost entirely in OCaml, whereas Lwt has thousands of lines of C code, which we think gives Async an edge in terms of our confidence in the implementation.
That said, there are a lot of nice things about Lwt that Async doesn’t have. Lwt has its own monadic syntax extension, a system of pluggable engines for supporting different polling mechanisms, and a few other niceties. We imagine that over time, the two libraries will exchange more ideas and will both get better as a result.
If you’re interested in Async, you can find it and the rest of the Core suite here.