Sunday, February 12, 2017

mkfile(8) Is Severely Syscall Limited

Marcel Weiher (Hacker News):

It never occurred to me that the problem could be with mkfile(8). Of course, that’s exactly where the problem was. If you check the mkfile source code, you will see that it writes to disk in 512 byte chunks. That doesn’t actually affect the I/O path, which will coalesce those writes. However, you are spending one syscall per 512 bytes, and that turns out to be the limiting factor. Upping the buffer size increases throughput until we hit 2GB/s at a 512KB buffer size. After that throughput stays flat.

[…]

The point is that the hardware has changed so dramatically that even seemingly extremely safe and uncontroversial assumptions no longer hold. Heck, 250MB/s would be perfectly fine if we still had spinning rust, but SSDs in general and particularly the scorchingly fast ones Apple has put in these laptops just changed the equation so that something that used to just not factor into the equation at all, such as syscall performance, can now be the deciding factor.

Comments RSS · Twitter

Leave a Comment