Bug 255306

Summary: [PATCH] Slow transfers with large files to mounted cifs shares even on 1Gbps link
Product: [Frameworks and Libraries] frameworks-kio Reporter: tony <lorefice2>
Component: generalAssignee: David Faure <faure>
Status: REOPENED ---    
Severity: normal CC: a.samirh78, a, adawit, arcooke, Avamander, bugs, kdelibs-bugs, me, Michael, mxmvasilyev0, nate, piedro.kulman, postix, saintdev, sitter, srikkanth87
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: proposed patch

Description tony 2010-10-26 12:46:22 UTC
Version:           4.5 (using KDE 4.5.2) 
OS:                Linux

when using kde system to transfer files to a windows system using a cifs mounted directory on an 1Gbps link, transfer is slow.

Reproducible: Always

Steps to Reproduce:
- To have a pair of Gbps NICS, one on windows, the other on linux.
- client: setup a network share on windows server side
- client: modprobe cifs CIFSMaxBufSize=150000
- client: mount.cifs //WINIP/WINSHARE /mountedshare/ -o user=username,pass=pass,rsize=57200,wsize=57000
- client: dd if=/dev/zero of=/tmp/zero bs=1M count=1000
- client: dd if=/tmp/zero of=/mountedshare/
- observe the reported speed (mine is about 50MBps)
- client: copy /tmp/zero to /mountedshare via dolphin
- observe the reported speed (mine is about 10MBps)

Actual Results:  
Kde speed is 1/5 than dd speed

Expected Results:  
kde speed to be similar to dd speed
Comment 1 tony 2010-12-02 13:53:21 UTC
I have the same "capped" speed (about 8MBps) if the mounted share is over ftp.
This was with filezilla server in ftp mode + curlftpfs.
Transfers via ftp command, dd, cp, mv give great speed. dolphin (just to say one) is much, much slower.
Comment 2 Michael Bauer 2011-03-08 21:06:46 UTC
Similar problem here, running Fedora14 with KDE 4.5.5. 

Copying 400MB file to my NAS (mounted using cifs) with konqueror has a maximum 
write speed of 4MB/second.
CPU load is constantly high (60%) during the process, according to top X itself uses
most CPU.

Copying the same file via plain "cp" command results in 9MB/sec with almost no
additional CPU load.
Comment 3 Michael Bauer 2011-03-08 21:46:11 UTC
Just upgraded to KDE 4.6.1 - Same behaviour.
Comment 4 Michael Bauer 2012-03-11 19:17:45 UTC
The problem is still existing. In the meantime i have complete new hardware, new Arch installation with currently kde 4.8.1. The problem is exactly the same like tony reported.
The NAS box is still the same (synology diskstation 207+).
Comment 5 Andrew Gaydenko 2012-10-23 12:55:18 UTC
Under Arch/KDE 4.9.2 reading form cifs is OK (up to 1Gn net limint), but writing to cifs is about 10 MB/s (instead of ~70-80 MB/s with not broken file managers). The bug is placed in KDE API somewhere as far as the issue takes place with both dolphin and krusader.

!! Please, change status at last !!
Comment 6 piedro 2013-01-25 09:46:30 UTC
Same here on Kubuntu 12.10 with KDE 4.10: 

Speed for copying a file on a NAS Server via CIFS (the UbuntuCD.iso0 file for example) shows only a speed of 1.5 to 2 MB/s. the same operation in nautilus (even when started within KDE) works with 7.5 to 8.5 MB/s. I have this behaviour since KDE4 - funny thing is using SMB4K to mount the CIFS shows higher speeds also ... but SMB4K is a mess in itself - so that's no solution just a crude workaround ... 

This has been reported a few times, plz comment or fix it. 

Thx for reading, piedro
Comment 7 Andrew Gaydenko 2013-01-25 10:11:18 UTC
Confirming the bug still takes place for 4.9.5 under Arch Linux.
Comment 8 piedro 2013-02-07 18:44:44 UTC
Updated to KDE 4.10 - still the same behaviour ... 

Could plz someone comment on this, I mean this is some core functionality not working right. there should be some concern about that ... 

thx, piedro
Comment 9 Andrew Gaydenko 2013-06-06 21:56:27 UTC
4.10.3 is still happy to live with this bug...
Comment 10 Dawit Alemayehu 2013-06-19 05:38:34 UTC
*** Bug 273200 has been marked as a duplicate of this bug. ***
Comment 11 Dawit Alemayehu 2013-06-24 12:40:44 UTC
This is probably caused by the same issue as the one I fixed for NFS mounts for https://bugs.kde.org/show_bug.cgi?id=317676. 

Would any of you be able to test the patch posted/committed for that bug report?  I cannot test because I do not have a remotely mountable CIFS drive. If not, one of you please update this ticket when KDE 4.10.5 is released in July. It contains the fix for NFS bug which I suspect should also solve this performance issue.
Comment 12 Andrew Gaydenko 2013-07-12 11:46:48 UTC
(In reply to comment #11)
> This is probably caused by the same issue as the one I fixed for NFS mounts
> for https://bugs.kde.org/show_bug.cgi?id=317676. 
> 
> Would any of you be able to test the patch posted/committed for that bug
> report?  I cannot test because I do not have a remotely mountable CIFS
> drive. If not, one of you please update this ticket when KDE 4.10.5 is
> released in July. It contains the fix for NFS bug which I suspect should
> also solve this performance issue.

The problem still exists in 4.10.5 (where that issue is fixed). Please, reopen.
Comment 13 Dawit Alemayehu 2013-07-13 07:34:52 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > This is probably caused by the same issue as the one I fixed for NFS mounts
> > for https://bugs.kde.org/show_bug.cgi?id=317676. 
> > 
> > Would any of you be able to test the patch posted/committed for that bug
> > report?  I cannot test because I do not have a remotely mountable CIFS
> > drive. If not, one of you please update this ticket when KDE 4.10.5 is
> > released in July. It contains the fix for NFS bug which I suspect should
> > also solve this performance issue.
> 
> The problem still exists in 4.10.5 (where that issue is fixed). Please, reopen.

Are you copying to a mounted drive or using kio_smb to copy files to your share drive? If the latter then that is a known weakness of kio_smb and has nothing to do with this ticket. To my knowledge no one has optimized kio_smb like the ftp and sftp kioslaves. As such, it is probably much slower when copying to a cifs shares using it. Otherwise, can you please provide the options you used to mount the cifs share? Perhaps I might be able to reproduce the problem.
Comment 14 Andrew Gaydenko 2013-07-13 09:27:45 UTC
(In reply to comment #13)
> Are you copying to a mounted drive or using kio_smb to copy files to your
> share drive? If the latter then that is a known weakness of kio_smb and has
> nothing to do with this ticket. To my knowledge no one has optimized kio_smb
> like the ftp and sftp kioslaves. As such, it is probably much slower when
> copying to a cifs shares using it. Otherwise, can you please provide the
> options you used to mount the cifs share? Perhaps I might be able to
> reproduce the problem.

Mounted cifs is in use:

~ $ sudo cat /etc/autofs/auto.master 

/somedir/nas /etc/autofs/auto.nas --timeout=5 --ghost

~ $ sudo cat /etc/autofs/auto.nas

media   -fstype=cifs,_netdev,nosuid,noexec,cache=none,nobrl,iocharset=utf8,noperm,nodev,rw,sec=ntlmv2,user=user,password=password ://nas/media

To estimate "good case": at my experiments the least affected - i.e. the fastest in working with cifs - not-KDE file manager is one called "worker".  It's speed is comparable with smbclient

The issue doesn't depend on samba version on the other side - both 3.x and the last 4.x were/are in use.
Comment 15 Dawit Alemayehu 2013-07-14 05:44:31 UTC
I have a potential patch for this problem, but someone needs to be able to test it. Can anyone here test a patch? You would need to compile kdelibs from source and you can use kdelibs from either the 4.10 or 4.11 branches.
Comment 16 Andrew Gaydenko 2013-07-14 13:04:24 UTC
(In reply to comment #15)
> I have a potential patch for this problem, but someone needs to be able to
> test it. Can anyone here test a patch? You would need to compile kdelibs
> from source and you can use kdelibs from either the 4.10 or 4.11 branches.

I'm ready to try against 4.10.5.
Comment 17 Dawit Alemayehu 2013-07-14 16:26:21 UTC
Created attachment 81108 [details]
proposed patch

Simply go to your kdelibs directory and do

git apply <downloaded-patch-file>
Comment 18 Dawit Alemayehu 2013-07-14 16:28:14 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > I have a potential patch for this problem, but someone needs to be able to
> > test it. Can anyone here test a patch? You would need to compile kdelibs
> > from source and you can use kdelibs from either the 4.10 or 4.11 branches.
> 
> I'm ready to try against 4.10.5.

I have attached the patch. You actually need to only recompile and install "kdelibs/kdecore", but compiling and install the whole of kdelibs is fine as well.
Comment 19 Andrew Gaydenko 2013-07-14 17:44:37 UTC
Dawit Alemayehu,
Have  tried the  patch, unfortunately it didn't resolve the issue - a speed  is the same.
Comment 20 Dawit Alemayehu 2013-07-15 01:34:30 UTC
(In reply to comment #19)
> Dawit Alemayehu,
> Have  tried the  patch, unfortunately it didn't resolve the issue - a speed 
> is the same.

Did you log out of KDE and log back in before testing the fix?
Comment 21 Dawit Alemayehu 2013-07-15 04:55:59 UTC
You can also try the patch suggested under bug# 291835 and see if that helps you out.
Comment 22 Andrew Gaydenko 2013-07-15 07:24:26 UTC
(In reply to comment #20)
> Did you log out of KDE and log back in before testing the fix?

Yes, of course! :)

(In reply to comment #21)
> You can also try the patch suggested under bug# 291835 and see if that helps
> you out.

Thanks, I will a little later.
Comment 23 Andrew Gaydenko 2013-07-15 07:50:49 UTC
(In reply to comment #21)
> You can also try the patch suggested under bug# 291835 and see if that helps
> you out.

That patch doesn't change anything also.
Comment 24 Dawit Alemayehu 2013-07-15 12:28:05 UTC
(In reply to comment #23)
> (In reply to comment #21)
> > You can also try the patch suggested under bug# 291835 and see if that helps
> > you out.
> 
> That patch doesn't change anything also.

That is my mistake. That was about kio_smb and not actually mounted CIFS partition.
Comment 25 Martin van Es 2013-12-03 14:44:56 UTC
I am seeing the same slowness on a CIFS mountpoint. Also, the systray copy indicator lacks progress and speed info (0 B/s). This is probably because the target file immediately gets created/provisioned it's final size on start? The latter seems to be due to the way CIFS handles the copy (it's the same when using cp on commandline).
Comment 26 Andrew Gaydenko 2014-06-22 14:42:49 UTC
I have noticed the version is changed to 4.10.5. I guess it is more appropriate to set 4.13.2, as far as the problem exits up now.
Comment 27 Andrew Gaydenko 2014-11-28 18:05:41 UTC
Again, I have noticed the version is changed to 4.13.2. I guess it is more appropriate to set 4.14.3, as far as the problem exists in the last KDE.
Comment 28 NiO 2016-02-19 08:24:51 UTC
I'm having the same issue.  Copying a large file (2-3GB) to my NAS, my transfer speed is around 4-6MB/s.  

Files seem to copy fine with cp from terminal
Comment 29 Maxim Vasilyev 2016-10-16 12:38:01 UTC
Unsure if it's the right place to report the problem, but the bugreport about my issue has been merged into this one.
File transfer from HD to flash (ext4 to ext4) drive takes way too long (moderate sized files, around 10-12 MB). Transfer speed jumps from 0 to 10 MBPS and goes down to 0 instantly.
This expirienced in KDE Neon October 2014 with KDE Frameworks 5.26, Applications 16.08.2, Plasma 5.8.2.
Comment 30 Vladimir Kulev 2018-06-25 20:49:29 UTC
Can confirm the problem with copying to CIFS mount. When copying with Dolphin or KTorrent (on download completion) the speed is about 3-4MB/s - verified with network monitor. With simple "cp" the speed is 7-8MB/s.

Frameworks 5.44.0
Dolphin 17.12.3
Qt 5.9.5
Comment 31 Harald Sitter 2020-04-08 13:13:42 UTC
Bouncing bug back to KIO.

A **mounted** cifs is a kernel filesystem mount, unrelated to kio-extras' smb plugin for KIO.
The trouble here seems to be that KIO::copy in general is substantially less efficient than the `cp` command.
Comment 32 Ahmad Samir 2020-04-08 13:21:20 UTC
Right, sorry for the noise :)
Comment 33 Avamander 2021-12-30 21:28:29 UTC
This issue has existed for seven years, is there really no way to ship this fix so that people can get better transfer speeds than 10Mbps on a 10000Mpbs link?