# CausalRPC: a traceable distributed computation framework

*2018-01-01 — idea*


The project aims to implement an RPC framework in OCaml using the [Irmin](https://github.com/mirage/irmin) distributed database library as a network substrate. It will explore the trade-offs of a novel data-oriented approach to RPC in which race conditions between clients are resolved automatically by the middleware layer. The core deliverable is a demonstration of an RPC client remotely executing functions with Irmin-serialisable parameters on a server capable of handling concurrent client requests.

The project was completed successfully, with an implementation of [CausalRPC](https://github.com/craigfe/causal-rpc), a distributed computation framework satisfying the above criteria.  The approach of making the statefulness of RPC explicit was surprisingly effective, allowing CausalRPC to provide stronger consistency and traceability guarantees than conventional RPC systems. This broadened the scope of the project considerably, allowing for a variety of extensions to explore the inherent trade-offs of the approach. The final version of CausalRPC supported fault-tolerant worker clusters and is compatible with [MirageOS](https://mirageos.org).


## Related reading

- [Mergeable persistent data structures](https://anil.recoil.org/papers/2015-jfla-irmin)

## Links

The project PDF writeup is publically [available](https://www.craigfe.io/causalrpc.pdf), and [Craig Ferguson](https://craigfe.io) won the G-Research Prize for Best Individual Project 2018 departmental prize.

[Craig Ferguson](https://craigfe.io) also gave a [talk about CausalRPC](https://ocaml.org/workshops/ocaml-workshop-2019) at the 2019 OCaml Workshop. Unfortunately the videos of that year's ICFP don't seem to have made it online, but the [slides are available](https://github.com/CraigFe/causal-rpc-talk).

[Craig Ferguson](https://craigfe.io) followed up with a podcast where he discussed his subsequent work on Irmin in 2022:

<iframe title="Casually talking with Craig Ferguson about OCaml, Mirage, Irmin and more" width="560" height="315" src="https://watch.ocaml.org/videos/embed/f3aa87e9-67a1-4569-b154-67d2d185152b" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
Status: Completed
Level: PartII
Year: 2018
Project: Unikernels
Supervisors: Anil Madhavapeddy
Students: Craig Ferguson

## Related

- [Mergeable persistent data structures](https://anil.recoil.org/papers/2015-jfla-irmin) (paper, 2015-01-01)

---
Canonical: https://anil.recoil.org/ideas/causal-rpc
Type: idea
License: CC BY 4.0 <https://creativecommons.org/licenses/by/4.0/>
Tags: ocaml, distributed, irmin, mirageos
