asomers/tokio-file

TODO: write a benchmark program

kamalmarhubi opened this issue · 4 comments

Very curious about how this performs vs a threadpool + futures::sync::oneshot.

Good question. Probably better, since it doesn't create any new OS threads.

I remember reading this on the topic a while back, which is why I was curious: http://blog.libtorrent.org/2012/10/asynchronous-disk-io/

Interesting read. I didn't know about the alignment restrictions for libaio. That's going to cause problems for tokio-file.

I added a simple microbenchmark that does a single 4KB read using tokio-file. For comparison, I added another microbenchmark that does the same 4KB read using futures::sync::oneshotin a new thread. On my system, POSIX AIO usually wins by about 4-5x. For example:

running 2 tests
test bench_aio_read      ... bench:       7,069 ns/iter (+/- 210)
test bench_threaded_read ... bench:      33,967 ns/iter (+/- 287