GNOME Bugzilla – Bug 762384
Samba download speed is very slow
Last modified: 2016-02-26 12:55:22 UTC
I got a samba server on network, I am testing the download speeds now. On Windows 7 with cable I got 84MB/s, on Windows 7 with wifi I got 10MB/s. On Fedora with smbclient (measured with watch) I got 11MB/s and the internet speed is just the same 11MB/s. With Nautilus I got only 4.4MB/s by downloading a file from the Samba server. So something is wrong with the Samba client of Nautilus.
I read somewhere that the problem is with gvfs. I can confirm that. If I mount the drive manually with the following command: ``` mount -t cifs -o username=root,password=xxxxx //192.168.0.186/asmedia-hdd /media/asmedia-hdd ``` I got 10.1MB/s instead of 4.4MB/s. Is there a way to force Nautilus to use this cifs instead of gvfs? I don't want to mount and discover network drives manually...
I moved the report from Nautilus to GVFS. I managed to mount from terminal with gvfs-mount and I reproduce the slow speeds with cp. So I am pretty sure that the problem is with GVFS and not with Nautilus. I suspect that the problem is with the buffer sizes GVFS uses, but I haven't found a way to verify this theory or to change the buffer size.
Hey, thanks for your bug report. It seems like duplicate of Bug 738535. Please try using smbget to copy the file and report what kind of speed you get. Don't you have any custom smb.conf configuration? (In reply to inf3rno from comment #2) > I moved the report from Nautilus to GVFS. I managed to mount from terminal > with gvfs-mount and I reproduce the slow speeds with cp. Please be sure you are using gvfs-copy instead... otherwise you might see worse performance due to the fuse backend (see Bug 688079).
(In reply to Ondrej Holy from comment #3) > Hey, thanks for your bug report. It seems like duplicate of Bug 738535. > > Please try using smbget to copy the file and report what kind of speed you > get. > > Don't you have any custom smb.conf configuration? > > (In reply to inf3rno from comment #2) > > I moved the report from Nautilus to GVFS. I managed to mount from terminal > > with gvfs-mount and I reproduce the slow speeds with cp. > > Please be sure you are using gvfs-copy instead... otherwise you might see > worse performance due to the fuse backend (see Bug 688079). Everything is default by the SMB server. Can you elaborate please what commands I should use? What I already tried: mouting with gvfs ``` gvfs-mount smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd cd ~/.gvfs/smb-share\:domain\=WORKGROUP\,server\=192.168.0.186\,share\=asmedia-hdd\,user\=root/ ``` mounting with cifs without gvfs ``` mount -t cifs -o username=root,password=xxxxx //192.168.0.186/asmedia-hdd /media/asmedia-hdd cd /media/asmedia-hdd ``` I copied the files with ``` cp bigfile testfile ``` and checked the speeds with ``` watch -- du -h testfile ``` It updates in every 2 secs, so by checking the difference between the sizes after 10 secs it is easy to count the speeds. Ofc. I tested these different mounts with nautilus as well, and I got the same speeds. Copying from gvfs was about 5MB/s and copying from non-gvfs was about 11MB/s using wifi. I checked with smbclient from command line too, and I got 11MB/s with that as well. I read the source code of the gvfs smb backend and I discovered, that gvfs uses 4KB buffer size and some places it is hardcoded (non-configurable), for example if you copy from smb to smb. By other parts of the code the buffer size is injected from upper abstraction levels. I did not check exactly from where, but I suspected that it is set to 4KB as well. According to you I was right. Why isn't 64KB the default buffer size? E.g. by my cifs mount example I used 1MB read buffer and 64KB write buffer. Both had the same 11MB/s speed. I can imagine that 4KB is too small and it behaves as a bottleneck. According to the code the client lib you use supports at most 64KB buffer size. Maybe you should update that lib or replace it with something better. Why isn't there somewhere a config file where we could give the default buffer sizes? I am not sure how to use the big_writes (what about big_reads?) option, or how not to use fuse. I just installed the newest Fedora with Gnome3 and I thought everything will work fine... Apparently this is not the case. I read many forums from the past 5 years and many people have problems with GVFS SMB speeds and they use CIFS mount instead, which is a poor workaround, since it does not have network discovery and you have to hardcode the password if you want to use it with nautilus (at least I did not have password prompt). I like the GUI for filesystem operations, so in long run I'd like to use GVFS from Nautilus and not from the command line. Can you give me some info about how to configure the system to always use the 64KB buffer size by GVFS SMB operations when I download or upload files with Nautilus?
(In reply to Ondrej Holy from comment #3) > Hey, thanks for your bug report. It seems like duplicate of Bug 738535. > > Please try using smbget to copy the file and report what kind of speed you > get. > > Don't you have any custom smb.conf configuration? > > (In reply to inf3rno from comment #2) > > I moved the report from Nautilus to GVFS. I managed to mount from terminal > > with gvfs-mount and I reproduce the slow speeds with cp. > > Please be sure you are using gvfs-copy instead... otherwise you might see > worse performance due to the fuse backend (see Bug 688079). You might be right that this is a duplicate, but I think if people report a problem over and over for 5 years, maybe it is really a problem you should fix somehow. I don't think by recent computers it matters whether you use 4KB or 64KB buffer size, because we have many GB-s of memory. Why is 4KB the default? What would be the impact if we'd increase the default to 64KB?
(In reply to inf3rno from comment #4) > (In reply to Ondrej Holy from comment #3) > > (snip) > > Everything is default by the SMB server. Can you elaborate please what > commands I should use? Please try comparing speed of the following commands: smbget smb://SERVER/FILE gvfs-copy -p smb://SERVER/FILE . It is bug in samba if smbget has more or less same speed as gvfs-copy (which should be same as you have with nautilus). SMB support in GVfs is based on libsmbclient, same as smbget. > What I already tried: > > mouting with gvfs > ``` > gvfs-mount smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd > cd > ~/.gvfs/smb-share\:domain\=WORKGROUP\,server\=192.168.0.186\,share\=asmedia- > hdd\,user\=root/ You have to use gvfs-copy instead of cp, because otherwise fuse daemon is used. Fuse daemon is just fallback to provide traditional POSIX API for applications, which are not based on GIO API. However it is limited, because those APIs are not fully compatible and thus you might see worse performance. (In reply to inf3rno from comment #5) > (In reply to Ondrej Holy from comment #3) > (snip) > > You might be right that this is a duplicate, but I think if people report a > problem over and over for 5 years, maybe it is really a problem you should > fix somehow. I don't think by recent computers it matters whether you use > 4KB or 64KB buffer size, because we have many GB-s of memory. Why is 4KB the > default? What would be the impact if we'd increase the default to 64KB? I am not sure why you think that GVfs uses 4kB buffer. As far as I know 64kB buffer is used in most cases using GIO API...
(In reply to Ondrej Holy from comment #6) > (In reply to inf3rno from comment #4) > > (In reply to Ondrej Holy from comment #3) > > > (snip) > > > > Everything is default by the SMB server. Can you elaborate please what > > commands I should use? > > Please try comparing speed of the following commands: > smbget smb://SERVER/FILE > gvfs-copy -p smb://SERVER/FILE . > > It is bug in samba if smbget has more or less same speed as gvfs-copy (which > should be same as you have with nautilus). SMB support in GVfs is based on > libsmbclient, same as smbget. > > > What I already tried: > > > > mouting with gvfs > > ``` > > gvfs-mount smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd > > cd > > ~/.gvfs/smb-share\:domain\=WORKGROUP\,server\=192.168.0.186\,share\=asmedia- > > hdd\,user\=root/ > > You have to use gvfs-copy instead of cp, because otherwise fuse daemon is > used. Fuse daemon is just fallback to provide traditional POSIX API for > applications, which are not based on GIO API. However it is limited, because > those APIs are not fully compatible and thus you might see worse performance. > > (In reply to inf3rno from comment #5) > > (In reply to Ondrej Holy from comment #3) > > (snip) > > > > You might be right that this is a duplicate, but I think if people report a > > problem over and over for 5 years, maybe it is really a problem you should > > fix somehow. I don't think by recent computers it matters whether you use > > 4KB or 64KB buffer size, because we have many GB-s of memory. Why is 4KB the > > default? What would be the impact if we'd increase the default to 64KB? > > I am not sure why you think that GVfs uses 4kB buffer. As far as I know 64kB > buffer is used in most cases using GIO API... Okay, I will try it out today. I found this part in the code: https://git.gnome.org/browse/gvfs/tree/daemon/gvfsbackendsmb.c?h=1.26.2#n1110 which uses 4K buffer. I checked again, this activates only by backup creation for do_replace, so probably not something major. I just suspected based on this that 4K is the default, but by other parts of the code the buffer size is injected from somewhere else, which I had no time to investigate.
I measured the speeds again with different copy methods: # works only if I mount the location with nautilus smbget -u root -w WORKGROUP smb://192.168.0.186/asmedia-hdd/testfile # it requires password even if I mount with nautilus wifi: 5.3MB/s cable: 18.5MB/s gvfs-mount smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd # does not work if I mount with nautilus # requires password gvfs-copy -p smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd/testfile . wifi: 5.5MB/s cable: 18.5MB/s nautilus # password saved by nautilus wifi: 5.2MB/s cable: 18.1MB/s nautilus CIFS mounted # password hardcoded to fstab wifi: 11.9MB/s cable: 85.8MB/s smbclient //192.168.0.186/asmedia-hdd -W WORKGROUP -U root # requires password get testfile testfile wifi: 11.9MB/s cable: 83.4MB/s You mentioned the fuse, I found something which might be interesting: mount | grep gvfs -> gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000) So Gnome (or whatever it does) appears to mount GVFS with GVFS fuse by default.
I'm sorry, but I don't know what we can do better, so changing status to duplicate... GVfs has same speed as official smbget tool provided by samba. Both are based on official libsmbclient.h api. My understanding is that smbclient tool, or cifs mount are using some internal smb api, which we can't use. You can add another comment on the following bug report and try to obtain some feedback from samba developers: https://bugzilla.samba.org/show_bug.cgi?id=10879 *** This bug has been marked as a duplicate of bug 738535 ***
(In reply to Ondrej Holy from comment #9) > I'm sorry, but I don't know what we can do better, so changing status to > duplicate... > > GVfs has same speed as official smbget tool provided by samba. Both are > based on official libsmbclient.h api. My understanding is that smbclient > tool, or cifs mount are using some internal smb api, which we can't use. > > You can add another comment on the following bug report and try to obtain > some feedback from samba developers: > https://bugzilla.samba.org/show_bug.cgi?id=10879 > > *** This bug has been marked as a duplicate of bug 738535 *** Okay, thanks!