Efficient File Copying on Linux
eklitzke.org
eklitzke.org
I don't want to be overly extremely dismissive or arrogant here, but this post pretty much boils down to "128 KiB is optimal because that number appears somewhere else, too, and that other spot even has somehow something to do with I/O".
That's about it.
You want a blocksize sized so that it takes around 10 ms to write to disk. So around 128K to 1MB, depending on the underlying hardware.
"The author of this file did a benchmark using dd if=/dev/zero of=/dev/null with different values of the bs (block size) parameter. On a wide variety of systems, including older Intel CPUs, modern high-end Intel CPUs, and even an IBM POWER7 CPU, a 128 KB block size is fastest. I used gnuplot to graph these results, shown below (higher transfer rate is better). The different symbols represent different system configurations."
Are you serious? He tested /dev/zero to /dev/null and assumed that was somehow related to readahead of a hard disk.
It's easy enough to start substituting in disk specifications for read or write and continue the experiment.
If you want to abstract away disk IO then use a memory drive.
You need to redo this article using actual reads and writes. Try it with both a quiet machine and a semi-busy one.
With actual I/O devices the difference should be negligible. Sequential reads and writes are well optimized at every level, from the CPU to the HDD.
(I wonder though what API the "cp" command would use to accomplish that).
link(2)
http://man7.org/linux/man-page/man2/ioctl_ficlonerange.2.htm...
> http://man7.org/linux/man-page/man2/ioctl_ficlonerange.2.htm....
This unfortunately doesn't yet work with zfs on Linux. One of my only gripes with it.
[1] - https://github.com/zfsonlinux/zfs/issues/405#issuecomment-50...
See [1] for an example of how bad this can be.
A number of people run dedup in production workloads. You just need to understand that it's a big and weirdly-shaped hammer, and can hit you in the head if you swing it without being ready for it.
https://docs.python.org/2/library/statvfs.html#statvfs.F_BSI...
So you never even have to leave the page cache, let alone copy into user space.
OFC it was implemented post 4.0 so I doubt GLibc supports it therefore the whole world pretends it doesn't exist.