IP networking using effects
  • OCaml 99.9%
  • Dune 0.1%
Find a file
Lucas Pluvinage e1e589840c readme
2022-06-22 18:50:26 +02:00
arp@e721843ed9 exception-based error handling 2022-06-22 18:46:40 +02:00
ethernet@7c19ae12b1 exception-based error handling 2022-06-22 18:46:40 +02:00
mirage-net@55899a4089 exception-based error handling 2022-06-22 18:46:40 +02:00
mirage-net-unix@0c0f5d7e6d exception-based error handling 2022-06-22 18:46:40 +02:00
mirage-tcpip@ffdbc7963c exception-based error handling 2022-06-22 18:46:40 +02:00
mirage-vnetif@cfae8a8a23 exception-based error handling 2022-06-22 18:46:40 +02:00
test exception-based error handling 2022-06-22 18:46:40 +02:00
utcp@f67c114b2d exception-based error handling 2022-06-22 18:46:40 +02:00
vendor exception-based error handling 2022-06-22 18:46:40 +02:00
.gitmodules exception-based error handling 2022-06-22 18:46:40 +02:00
.ocamlformat add the code 2022-02-18 18:14:11 +01:00
deps.opam working state 2022-05-06 14:54:30 +02:00
dune-project clean up 2022-04-06 15:00:15 +02:00
README.md readme 2022-06-22 18:50:26 +02:00

Networking experiments with OCaml 5's effects

Goal: port Mirage's TCP/IP stack on top of OCaml 5's effects for more manageable async code.

Creating a 4.12.0+domains switch

opam switch create 4.12.0+domains --repositories=multicore=git+https://github.com/ocaml-multicore/multicore-opam.git,default

Creating a 5.0.0+trunk switch

opam switch create 5.0.0+trunk --repositories=alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git,default

Optional: install lsp server:

opam pin -y git+https://github.com/patricoferris/ocaml-lsp#dc9a4ef8529628fe023e1ed034ffe6b517ea4f1a

Installing the project

git clone --recursive https://github.com/TheLortex/networking-experiments
cd networking-experiments
opam install --deps-only ./ -t
dune runtest

HTTP SERVER

Requirements:

  • a tap0 interface configured with 10.0.0.1/24 as an address

Bench:

  • dune exec test/http_tcpip.exe
  • wrk -t16 -c256 -d5s http://10.0.0.11:8080/

Results (lots of variation):

wrk 4.2.0 [epoll] Copyright (C) 2012 Will Glozer
Running 5s test @ http://10.0.0.11:8080/
  16 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    20.21ms    2.08ms  41.94ms   92.28%
    Req/Sec   792.44     90.29     1.37k    91.36%
  63913 requests in 5.10s, 127.75MB read
Requests/sec:  12535.60
Transfer/sec:     25.06MB

TCP SPEED

Original mirage-tcpip:

  • without pcap recording
test.exe: [INFO] Iperf server: t = 692458038, avg_rate = 1155.30 MBits/s, totbytes = 100000000, live_words = 143408
  • with pcap recording
test.exe: [INFO] Iperf server: t = 1000016465, avg_rate = 553.78 MBits/s, totbytes = 69223140, live_words = 131837
test.exe: [INFO] Iperf server: t = 1441745933, avg_rate = 554.88 MBits/s, totbytes = 100000000, live_words = 101111

Eio mirage-tcpip:

  • without pcap recording
test.exe: [INFO] Iperf server: t = 1000014908, avg_rate = 790.52 MBits/s, totbytes = 98815900, live_words = 65104
test.exe: [INFO] Iperf server: t = 1012995882, avg_rate = 789.74 MBits/s, totbytes = 100000000, live_words = 64879
  • with pcap recording
test.exe: [INFO] Iperf server: t = 1000298217, avg_rate = 235.22 MBits/s, totbytes = 29411320, live_words = 4463730
test.exe: [INFO] Iperf server: t = 2000327795, avg_rate = 241.19 MBits/s, totbytes = 59560600, live_words = 8970173
test.exe: [INFO] Iperf server: t = 3000669694, avg_rate = 248.89 MBits/s, totbytes = 90682200, live_words = 13622019