Subject: mount_smbfs vs. smbclient : 1 - 2.
To: None <netbsd-users@netbsd.org>
From: Martin S. Weber <Ephaeton@gmx.net>
List: netbsd-users
Date: 09/21/2007 13:46:42
Hey NetBSD Users.
I'm seeing something strange and am doing what I always used to: come here
and ask you. Have you seen something similar? Do you know how to fix it?
short story: smbclient outperforms mount_smbfs in writing to the samba
share by factor 4 to 5.
client machine: netbsd 4.0 beta 2.
server machine: ditto.
both connected via 100mbit, switched.
measurements:
# -- samba - writing
# smbclient. This is somewhere near expected.
#
$ smbclient -N -c "cd samba-share;put file.bz2" '\\smb.srv\data'
putting file file.bz2 as \daten\tmp\fritzilein\file.bz2 (5570.2 kb/s) (average 5570.2 kb/s)
# ok, try through mount_smbfs mounted samba share. First
# with dd to play with the blocksizes.
#
$ bs=512
# start out with half a meg and double up, trying once
# the 'bs' setting, once the 'obs'.
#
$ while [ $bs -lt 64000 ]; do for block in obs bs; do echo "bs:$bs block:$block";
dd if=file.bz2 of=/somewhere/samba-share/file.bz2 $block=$bs
# results.
# Worse than 1/4 of the smbclient result.
#
bs:512 block:obs 83117097 bytes transferred in 68.297 secs (1216994 bytes/sec)
bs:512 block:bs 83117097 bytes transferred in 68.316 secs (1216656 bytes/sec)
bs:1024 block:obs 83117097 bytes transferred in 44.410 secs (1871585 bytes/sec)
bs:1024 block:bs 83117097 bytes transferred in 44.746 secs (1857531 bytes/sec)
bs:2048 block:obs 83117097 bytes transferred in 44.197 secs (1880604 bytes/sec)
bs:2048 block:bs 83117097 bytes transferred in 47.088 secs (1765143 bytes/sec)
bs:4096 block:obs 83117097 bytes transferred in 46.196 secs (1799227 bytes/sec)
bs:4096 block:bs 83117097 bytes transferred in 44.257 secs (1878055 bytes/sec)
bs:8192 block:obs 83117097 bytes transferred in 48.595 secs (1710404 bytes/sec)
bs:8192 block:bs 83117097 bytes transferred in 50.414 secs (1648690 bytes/sec)
bs:16384 block:obs 83117097 bytes transferred in 42.976 secs (1934035 bytes/sec)
bs:16384 block:bs 83117097 bytes transferred in 47.292 secs (1757529 bytes/sec)
bs:32768 block:obs 83117097 bytes transferred in 48.668 secs (1707838 bytes/sec)
bs:32768 block:bs 83117097 bytes transferred in 48.268 secs (1721991 bytes/sec)
# dd with default settings / buffersizes
#
default 83117097 bytes transferred in 102.354 secs (812055 bytes/sec)
# writing via cp(1) isn't any better. Lookup the time in the one
# megabyte buffersize example above.
#
$ time cp -fv file.bz2 /somewhere/samba-share/file.bz2
file.bz2 -> /somewhere/samba-share/file.bz2
45.90s real 0.01s user 0.28s system
# -- samba - reading
# smbclient. This again is somewhere near expected. (I know for large files it
# goes up to the network max).
#
$ smbclient -N -c "cd samba-share;get file.bz2" '\\smb.srv\data'
getting file \samba-share\file.bz2 of size 83117097 as file.bz2 (6458.9 kb/s) (average 6458.9 kb/s)
# cp(1) surprises me given the results in the write case.
#
$ time cp -fv /somewhere/samba-share/file.bz2 file.bz2
/somewhere/samba-share/file.bz2 -> file.bz2
13.78s real 0.00s user 0.39s system
# so does dd. Same as above, this time use ibs and bs.
# results are near the smbclient result.
#
$ bs=512
$ while [ $bs -lt 64000 ]; do for block in ibs bs; do echo "bs:$bs block:$block";
dd of=file.bz2 if=/somewhere/samba-share/file.bz2 $block=$bs
bs:512 block:ibs 83117097 bytes transferred in 14.680 secs (5661927 bytes/sec)
bs:512 block:bs 83117097 bytes transferred in 13.050 secs (6369126 bytes/sec)
bs:1024 block:ibs 83117097 bytes transferred in 14.686 secs (5659614 bytes/sec)
bs:1024 block:bs 83117097 bytes transferred in 13.068 secs (6360353 bytes/sec)
bs:2048 block:ibs 83117097 bytes transferred in 14.671 secs (5665400 bytes/sec)
bs:2048 block:bs 83117097 bytes transferred in 13.020 secs (6383801 bytes/sec)
bs:4096 block:ibs 83117097 bytes transferred in 14.777 secs (5624761 bytes/sec)
bs:4096 block:bs 83117097 bytes transferred in 13.006 secs (6390673 bytes/sec)
bs:8192 block:ibs 83117097 bytes transferred in 14.696 secs (5655763 bytes/sec)
bs:8192 block:bs 83117097 bytes transferred in 12.993 secs (6397067 bytes/sec)
bs:16384 block:ibs 83117097 bytes transferred in 14.716 secs (5648076 bytes/sec)
bs:16384 block:bs 83117097 bytes transferred in 13.009 secs (6389199 bytes/sec)
bs:32768 block:ibs 83117097 bytes transferred in 14.797 secs (5617158 bytes/sec)
bs:32768 block:bs 83117097 bytes transferred in 13.721 secs (6057655 bytes/sec)
I didn't find any options on mount_smbfs relating to buffersizes or the like,
so what to tune?
Furthermore I often see process "choke hard" in smb_wrq - I.e. try and fts_read
a directory with like 300 subdirs with on avg. two subdirs, process hangs unkillable
(even -9) there, obviously doing nothing. Eons later it might run either out
of filedescriptors, or eventually succeed and return. In contrast, processes
WRITING to the share are basically always unkillable. The above dd's e.g. were
not killable, not even -9. Yay.
... Help?
-Martin