-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZFS + Samba + sendfile (mmap) = issues #1156
Comments
It's hard to say for certain without the profiling data but two possibilities come to mind.
|
@behlendorf |
@tomposmiko I'm not aware of anyone working on implementing |
This issue caught my attention and I've been looking into the source code of Linux' VFS. IIRC the sendfile syscall is implemented via the splice_read/splice_write function callbacks in the function_operations struct. Ext4 and XFS implement both callbacks via generic functions provided by fs/splice.c. Hence, it should be possible to use these generic funtions for ZFS, too. So, implementing sendfile should be as easy as adding the following code snippet to module/zfs/zpl_file.c: (untested so far)
These two callbacks make use of read_iter and write_iter VFS callbacks which are provided by ZFS. @behlendorf Am I missing something? Are there any special things in ZFS I am not aware of? |
@Nilix007 if all you need to make use of are already registered It's certainly worth investigating! You might be able to find some existing test cases for this in xfstests. |
Inspired by openzfs/issues/1156 Fixes vpsfreecz/vpsadminos#36 Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
@behlendorf I notice that 1c2358c adds the |
This is all, |
Case: production system with 10Gb Ethernet exporting ZFS-backed file shares from Samba to Windows 7 workstations. SMB2 protocol is being used (forced in smb.conf), and Samba is v4 (release).
Problem: Turning on Samba's option to use sendfile system call (zero copy path) slows transfers down, when it should speed them up.
Server has dual E5620 Xeons and 96 GB RAM. Intel 10GbE 82599EB NIC (same on client). Client in this case has dual X5670 Xeons and 24 GB RAM. Server's running kernel 3.4.6, and client is on Windows 7 SP1 (both x64).
Reference transfer speed is obtained from RAMdisk to RAMdisk copy of a 20GB file. Different Samba versions (3.6.x -> 4.0 release) were tested with different optimizations and smb.conf options to obtain best possible "raw" transfer speeds. Linux network stack had to be tuned also (send & receive window sizes mostly in addition to jumbo frames) to obtain passable 10GbE throughput (close to wire speed with iperf).
The next tests are run 5 times and averages taken. First run is discarded (to make sure the test file is cached) so we disregard disk accesses completely.
Copying the aforementioned file from server to client using RAMdisk as origin and destination results in roughly 710 MB/s throughput with sendfile. Without sendfile throughput drops to about 340 MB/s.
Next up is testing with XFS. We create a zvol, and make an XFS filesystem on top of it. We then copy the same file from RAMdisk to XFS, drop caches and do the copy again from client. Now we get around 670 MB/s with sendfile, and about 320 MB/s without sendfile.
Finally we test with ZFS. Copy the same file to ZFS dataset, then copy from client. With sendfile we now get 310 MB/s (!!), and without sendfile we get 370 MB/s (!!).
Quite interesting. ZFS behaves completely differently from RAMdisk and XFS here. What could possibly cause this discrepancy? According to sendfile's documentation, it uses mmap in the implementation, so there could be something iffy in ZFS's mmap code. Does anyone have more ideas?
Currently I'm profiling (with Oprofile and perf toolstack) what happens in the kernel when these tests are being run, but the profiling data is hard to make sense of. Next I'll take a look at the differences in mmap in XFS and ZFS, but I'm not sure if my knowledge in that area is sufficient to decipher the details.
I'll post my profiling findings in a later post, hopefully tomorrow. In the meantime, please feel free to make suggestions etc.
The text was updated successfully, but these errors were encountered: