Sparse files in ZFS are slow. Default behavior is to allocate a temporary dbuf, zero it and destroy on return. There is no caching. Bandwidth is limited by cpu time bzeroing temporary dbufs.
The attached patch avoids creating temporary dbufs.
4k reads are important for mmapped files.
without the patch:
zfs recordsize=128k, 4k reads:
104857600 bytes transferred in 1.178753 secs (88956388 bytes/sec)
zfs recordsize=8M, 4k reads:
8388608 bytes transferred in 9.134382 secs (918355 bytes/sec)
with the patch:
zfs recordsize=128k, 4k reads: (13x improvement)
1048576000 bytes transferred in 0.904384 secs (1159436525 bytes/sec)
zfs recordsize=8M, 4k reads: (over 1000x improvement)
1048576000 bytes transferred in 0.909877 secs (1152437009 bytes/sec)
Fix: Patch attached with submission follows:
How-To-Repeat: # truncate -s 1000m testfile
# time dd if=testfile of=/dev/null bs=4k
Over to zfs-devel@ for review.
For bugs matching the following criteria:
Status: In Progress Changed: (is less than) 2014-06-01
Reset to default assignee and clear in-progress tags.
Mail being skipped