The Case for Writing Network Drivers in High-Level Programming Languages [such as Haskell]

At work, I came across this case study from 2019 about implementing network drivers in various high-level programming languages, including Haskell.

The Haskell network driver implementation is here:

The Haskell implementation is not very performant (both in terms of latency and throughput), but it is small (both in terms of lines of code and source size) and doesn’t include any c code. Per the authors, Haskell also protects against major classes of bugs found in the original C driver: OOB in general memory, use-after-free in general memory, OOB in packet buffers, use-after-free in packet buffers, and int overflow.

I’m curious if there have been any developments since 2019 that would make Haskell better-suited for this use case. nonmoving gc is one, as it should reduce latency (which is very important for this application), but are there any others?

5 Likes

I remember wanting to try some possible improvements at the time, but it requires specific hardware to run, so I couldn’t try it myself.

Here is a link to some discussion I (/u/noughtmare) had with the author:

https://old.reddit.com/r/haskell/comments/d355cg/comparisonbenchmark_a_highspeed_network_driver/f00l3ux/

2 Likes

I haven’t seen anything in this vein using Haskell specifically, and the obvious high-level language in this space is now Rust. But if you want to stay within the ML-family, perhaps OxCaml might be worth a look?

Linear Types are new since 2019 and I’d imagine they could help with some stuff. One example in the paper is even a socket API!

3 Likes