io_uring backend for Async. Currently only used for watching file descriptors and very beta; expect lots of crashes.
build instructions (w/ OCaml 4.11.1, YMMV for other versions):
$ git clone --recursive https://github.com/mt-caret/async_io_uring
$ opam install dune dune-configurator ocaml-compiler-libs ocaml-migrate-parsetree octavius stdlib-shims
$ cd async_io_uring/io_uring_test
$ dune build --profile release @@default
$ ASYNC_CONFIG="((file_descr_watcher Io_uring))" ../_build/default/io_uring_test/async_tcp_server.exe
currently, the following libraries have been forked w/ changes:
- core
- ppx_sexp_conv
- ppx_expect
- ppx_string
- ppx_sexp_message
- ppx_custom_printf
- ppx_fields_conv
- ppx_optcomp
- async
- async_kernel
- async_unix
benchmarks:
currently, Async using the io_uring backend seems to be a bit slower than the
epoll backend? tested using the command
ab -n 100000 -c 10 http://localhost:8000/
.
epoll backend:
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 1 1.6 1 21
Waiting: 0 1 1.5 1 21
Total: 0 1 1.6 1 21
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 2
90% 3
95% 5
98% 7
99% 9
100% 21 (longest request)
io_uring backend:
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 1 1.6 1 28
Waiting: 0 1 1.6 1 28
Total: 0 1 1.6 1 28
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 2
90% 3
95% 5
98% 6
99% 10
100% 28 (longest request)
todo:
- figure out above benchmarks
- shot in the dark guess: allocation of a list in the critical path is the culprit? possibly return a immediate option?
- investigate ETIME in
io_uring_peek_cqe()
- keep track of the number of in-flight I/O and implement pushback