Why io_uring without readahead is slow: a deep dive into Turso's I/O
A Turso PR implementing readahead for the io_uring backend sparked an investigation into why io_uring with O_DIRECT and no readahead is slower than syscall. The author measures TPC-H Q6, showing that readahead enables request merging, reducing device requests from ~196k to ~16k. They also analyze the cost of SQ polling and cache misses, concluding that O_DIRECT skips the page cache copy, leading to more cache misses during query execution.
With O_DIRECT, though, the disk writes the data into the process buffer directly without the copy step, which means the CPU doesn’t get involved in the process, so nothing is copied to the CPU caches.