Subject: kern/37025: mount_smbfs write performance is
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <Ephaeton@gmx.net>
List: netbsd-bugs
Date: 09/25/2007 15:45:00
>Number:         37025
>Category:       kern
>Synopsis:       mount_smbfs write performance is <censored>
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 25 15:45:00 +0000 2007
>Originator:     Martin S. Weber
>Release:        NetBSD 4.0 Beta 2 - mid sep 2007
>Organization:
	
>Environment:
	
	
System: NetBSD rfhinf038 4.0_BETA2 NetBSD 4.0_BETA2 (GENERIC) #0: Mon Sep 17 16:41:59 CEST 2007  root@rfhinf038:/usr/home/netbsd/netbsd-4-obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	(see also http://mail-index.netbsd.org/netbsd-users/2007/09/21/0001.html)

	mount_smbfs write performance sucks. It is outperformed by smbclient(1) 
	by a factor of 4 to 5. This is not acceptable, as it basically renders
	it unusable.

	Here are some measurements between two 4.0 b2 nbsd i386 machines on
	a local 100mbit lan:

	 -- 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)

	 $ bs=512
	 $ 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

	$ 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)

	
>How-To-Repeat:
	Use a nbsd 4.0 samba server (3.0.24), use a nbsd 4.0 client, hang 'em on
	a 100mbit lan, try to write an iso image to the samba server and then
	control the upcoming waves of aggression and the felt need to kill somebody
	near. Then, try to kill (even -9) the process just for fun (not that it'd
	work when it's in smbwrq state). Scream some. Then use smbclient.
	
>Fix:
	dunno. But someone prolly should fix that before 4.0
	

>Unformatted: