Dear OCaml enjoyers,
I’m quite giddy at the opportunity to announce the release of Moonpool 0.5. Moonpool is a MIT-licensed thread-pool library for OCaml 5, with an eye towards mixed IO and CPU workloads.
Moonpool’s unique design allows the creation of multiple thread pools that share an underlying domain pool. Due to how domains work in OCaml 5, there should be at most
n domains active at once, where
n is roughly the number of cores on the machine. For mixed workloads that rely on threads, this is not really adequate as it means that only
n tasks can run or block on IO at the same time. Instead Moonpool permits the creation of many more threads, possibly in independent pools (ie. with independent schedulers), for different workloads.
Moonpool also provides some concurrency primitives such as futures, locks, and a blocking queue.
This release (changelog) has seen a lot of change in Moonpool: there are now two distinct pool implementations that abide by the same
- “fifo” pool: a simple pool with a single blocking queue for workloads with coarse granularity tasks that value latency (e.g. a web server)
- “ws” pool: a work-stealing pool for heavy compute workloads that feature a lot of await/fork-join, with a lot of help from Sadiq, KC, and especially Vesa Karvonen (@polytypic) to whom I’m very grateful for his help and explanations.
Documentation can be found here.
for now, at least. ↩︎