bustub icon indicating copy to clipboard operation
bustub copied to clipboard

Why not use IO_DIRECT in src/storage/disk/disk_manager.cpp to improve efficiency?

Open zeminzhou opened this issue 3 years ago • 2 comments

Now that we have managed the disk cache ourselves, why not use IO_DIRECT to reduce memory copies?

zeminzhou avatar Apr 04 '21 01:04 zeminzhou

Yes we should be using direct I/O. Please send a patch. Thanks!

apavlo avatar Apr 04 '21 02:04 apavlo

Note that this will impose buffer size and alignment requirements and assuming you want the data durable, still requires explicit fsync calls which is often the bottleneck for disk IO performance.

see discussion here: https://www.percona.com/blog/2018/02/08/fsync-performance-storage-devices/

Please benchmark your proposed changes when you submit a patch. Also please ensure cross-platform compatibility (macOS does not have O_DIRECT and instead uses fcntl to disable write cache).

It should be an interesting experiment! Good luck!

mbutrovich avatar Apr 04 '21 12:04 mbutrovich