Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

  1. #1
    Join Date
    May 2005
    Beans
    148
    Distro
    Ubuntu 20.04 Focal Fossa

    Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    I've noticed that no matter what I do, I can only get read/write performance of around 11MB/s with my Ubuntu 20.04 file server running Samba Version 4.11.6-Ubuntu using Ubuntu, MacOS 10.15, Windows 10 clients for a file of around 250GB. If I share a folder on Windows, I can get above 100MB/s performance with the same clients and file size. Is Samba just that bad compared to Windows? It's pretty consistently around 10x slower on Ubuntu Samba. I have a lightly loaded 1Gb/s LAN, so 100MB/s (1B=~8b) is about as good as you can do. I've tried many conf commands in smb.conf. I'm ready to give up and just host my file service on Windows. Any last minute ideas before I make the change in Host?

    the [GLOBAL] part of smb.conf:
    Code:
    log level = 1
    #std#socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072 SO_KEEPALIVE
    socket options = TCP_NODELAY SO_RCVBUF=131072 SO_SNDBUF=131072 SO_KEEPALIVE IPTOS_THROUGHPUT
    
    #no better than buf=131072#socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=2097152 SO_SNDBUF=2097152
    # this one is really slow#socket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=8192 SO_RCVBUF=8192
    read raw = Yes
    write raw = Yes
    strict locking = No
    strict allocate = Yes
    allocation roundup size = 4096
    server signing = No
    oplocks = yes
    max xmit = 65535
    dead time = 15
    getwd cache = yes
    #min receivefile size = 32768
    min receivefile size = 16384
    use sendfile = true
    aio read size = 16384
    aio write size = 16384
    #aio read size = 32768
    #aio write size = 32768
    use sendfile = true
    
    # Performance specific for MacOS
    min protocol = SMB2
    vfs objects = fruit streams_xattr  
    fruit:metadata = stream
    fruit:model = MacSamba
    fruit:posix_rename = yes 
    fruit:veto_appledouble = no
    fruit:wipe_intentionally_left_blank_rfork = yes 
    fruit:delete_empty_adfiles = yes

  2. #2
    Join Date
    May 2010
    Beans
    1,357

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    How about SSHFS / SFTP instead? I assume you have installed openssh-server... Mac OS can connect to SFTP natively

  3. #3
    Join Date
    May 2005
    Beans
    148
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    OMG, the performance of sftp is even worse. Can't get more than 4MB/s. At least I could get 11MB/s with Samba. Judging from all of the replies on other forums, it just seems that that's about the best that Samba can do. Is it just a factor of SAMBA code performance, or is there a setting that really caps the bandwidth?

  4. #4
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,363

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    The performance is not capped. SMB is just a very inefficient and chatty protocol. SFTP will be even worse, since is also has to encrypt and decrypt the data. Run tcpdump or wireshark to see what is going on.

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,603
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    I use NFS whenever possible.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,363

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    Note that ordinary FTP is also much faster. FTP is natively supported by Windows file managers also. The user level security is bad, but so is that of SMB.

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    Quote Originally Posted by mike4ubuntu View Post
    OMG, the performance of sftp is even worse. Can't get more than 4MB/s. At least I could get 11MB/s with Samba. Judging from all of the replies on other forums, it just seems that that's about the best that Samba can do. Is it just a factor of SAMBA code performance, or is there a setting that really caps the bandwidth?
    I don't have samba on 20.04, but on 18.04, this version works:
    Code:
    samba            2:4.7.6+dfsg~ amd64
    I see 65-75MBps transferring files FROM Windows to Ubuntu using SMB v2.1. Something isn't right on your systems. I don't know what it is. With 20.04, a number of samba defaults changed. At the same time, Win10 changed some of those defaults ... and some didn't line up to make it easy to install and just work.

    I get better performance with NFS, but that is harder to use with Windows. I understand NFS is part of some Win10 versions. It was in Enterprise and Ultimate Win7 releases, but not Home or Professional. Getting the Windows UserID ---> Unix uid/gid mappings setup was always a hassle.

    sshfs is dog slow, always. I only use it when a complex program/tool is on 1 system and the data to be input/acted on is on any other system, but not available over NFS. Moving that complex setup to the system that has the data would be too much effort, so sshfs can be used for access while I have lunch or sleep. That doesn't help Windows users. Too bad.

    sftp is natively supported by nearly all Unix file managers. Just put sftp://..... as the URL into the file manager. Because it is encrypted, there is overhead, but nothing as bad as sshfs. That doesn't help Windows users. Too bad.

    scp and rsync feel a little faster than sftp. Again, if I don't have access to either side of the storage using NFS, then I'll use those to transfer. scp for files inside 1 directory that aren't already on the other side and rsync when an entire directory structure is involved. That doesn't help Windows users. Too bad.

    Windows has WinSCP as an scp and sFTP program. It integrates with MS-Explore - full drag-n-drop and has a 2-pane layout for source and target. Most end-users would figure this out.

    I stopped using plain FTP around 2002. Security. If I need to make a file accessible to a few friends, I'll bury that file in a web server I control and send those friends the exact HTTPS link. Then I'll use 'at' to delete the file in 1-2 weeks automatically. I use 'at' to schedule future events all the time. Right now, 14 things are scheduled for this week currently.

    To share a file, even a huge file, with one of my Linux buddies, I'll use Magic Wormhole. It is in the repos or there is a snap package if you only want to touch storage in your HOME directory (which I seldom desire). I use the APT package. Snagged a 31G set of files a few weeks ago from a friend. Left it running overnight.

    Anyway - when it comes to performance issues, break apart the problem and work backwards. Fix issues in order.
    1. Check the network performance - iperf3
    2. Check the disk and file system performance fio/bonnie++
    3. Check the samba protocol performance - increase logging to see any issues.


    Blaming Samba when the disk is about dead isn't exactly fair, especially when others are getting 65+ MB/sec (520Mbps) transfers.
    Code:
    $ time cp  Home_Movie-2004.mkv /Data/K/
    
    real    0m17.190s
    user    0m0.007s
    sys     0m1.722s
    
    $ \du -s Home_Movie-2004.mkv
    1913392  Home_Movie-2004.mkv
    
    $ df -Th  .
    Filesystem       Type  Size  Used Avail Use% Mounted on
    //172.22.22.14/K cifs   74G   19G   55G  26% /Data/K
    
    $ mount |grep /Data/K
    //172.22.22.14/K on /Data/K type cifs (rw,relatime,vers=2.1,cache=strict,username=tf,uid=1000,forceuid,gid=1000,forcegid,addr=172.22.22.14,file_mode=0664,dir_mode=0775,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1)
    Using Windows Exploder, saving files to CIFS storage I see about 50% of the GigE connection in Task Manager ... which is 62.5 MBps. Both disks involved are not SSDs, but old WD disks. Blue inside the Linux system and a true WD-Black in the Windows box. WD-Black drives are quality and fast in my experience. The 5 yr warranty doesn't hurt either.

    Using the numbers in my actual transfer commands above, we can do some calculations:
    1913392 bytes / 17.19 seconds = 113 MB/sec ... using clock time. That really isn't fair, because there is disk caching in RAM that makes it seem faster than it is. Plus, on a GigE network, 125MB/s is the theoretical max possible without using link aggregation.

    Going in the opposite direction, it took 24.524s ... so that works out to 79.33 MB/sec. I cheated and stored the file on an SSD this time. Redoing it to the WD-Blue ... was about the same 25.8s.

    Transferring lots of small files is drastically slower. That's about the overhead in creating files, allocations, sectors, etc.

    Hopefully, this has provided some ideas for steps. I'm happy to post my smb.conf stuff, if that would help. I mount Windows storage using autofs, so that won't be too helpful. Also, I ran all the commands initiated from the Linux side because I know how to capture transfer data there, but not on Windows. Capturing random screens during the xfer just doesn't seem scientific.

  8. #8
    Join Date
    May 2005
    Beans
    148
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    Thanks for everyone's help. I haven't tried NFS, but it seems hard to implement on Windows. I tried some of the TheFu's numbers, but nothing seems to help so far. It seems like Windows native SMB support is just a lot faster than SAMBA especially for large files. I think I'll probably just have to start using Win10 as my file servers. Windows as a file server gets consistently 110 MB/s which is close to the theoretical max. I'm curious to try WSL 2. The latest Microsoft preview version has Linux GUI support and can run Ubuntu 20.04. I guess SAMBA just isn't as good as the real thing, but I would have expected it to be better than 10% as good.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    Quote Originally Posted by mike4ubuntu View Post
    Thanks for everyone's help. I haven't tried NFS, but it seems hard to implement on Windows. I tried some of the TheFu's numbers, but nothing seems to help so far. It seems like Windows native SMB support is just a lot faster than SAMBA especially for large files. I think I'll probably just have to start using Win10 as my file servers. Windows as a file server gets consistently 110 MB/s which is close to the theoretical max. I'm curious to try WSL 2. The latest Microsoft preview version has Linux GUI support and can run Ubuntu 20.04. I guess SAMBA just isn't as good as the real thing, but I would have expected it to be better than 10% as good.
    Something isn't right on your systems. I don't know what it is. That doesn't mean it is bad for everyone.
    If you want to give up, fine.
    If you want help, post similar commands and output, so data is provided for others to see. It s frustrating when no facts are provided.

  10. #10
    Join Date
    May 2005
    Beans
    148
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Is Samba read/write rate performance on Ubuntu 20.04 capped at around 11MB/s?

    yes, something could be wrong with the system, but what? If there are better settings for SAMBA I would like to see them. Also, if there are, why are they not the defaults. This performance issue with SAMBA seems to be common theme in all the forums. I provided those conf settings in my first post. I've experimented with the conf files settings based on others having similar problems. Again, the MacOS and Windows share servers running on the same subnet, don't seem to have this performance issue.

    I've also investigated the network settings. I've used iperf3 to get network performance numbers, which indicated a possible issue with the interface itself. I have the SAMBA server going through the same 1Gbit router as the Windows and MacOS server. I even replaced the SAMBA server's Ethernet cable with a new Cat 8 cable.

    However, I can't rule out an issue with the Ethernet interface

    Code:
    lspci | grep -i ethernet
    06:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
    07:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
    The 1Gbit light is on the RJ45 jack.

    iperf3 stats:
    UDP numbers seem ok, but TCP numbers don't, although. I suppose the UDP numbers should be faster than TCP to some degree, but don't understand the wide discrepancy.

    iperf3 UDP:
    Code:
    iperf3 -u -b 1Gbps -l 1000 -c ss.ss.ss.ss
    Connecting to host <SAMBA Server>, port 5201
    [  4] local cc.cc.cc.cc port 57998 connected to ss.ss.ss.ss port 5201
    [ ID] Interval           Transfer     Bandwidth       Total Datagrams
    [  4]   0.00-1.06   sec   778 KBytes  6.00 Mbits/sec  797
    [  4]   1.06-2.03   sec   261 KBytes  2.20 Mbits/sec  267
    [  4]   2.03-3.01   sec   270 KBytes  2.25 Mbits/sec  276
    [  4]   3.01-4.06   sec   283 KBytes  2.22 Mbits/sec  290
    [  4]   4.06-5.03   sec   266 KBytes  2.23 Mbits/sec  272
    [  4]   5.03-6.01   sec   264 KBytes  2.21 Mbits/sec  270
    [  4]   6.01-7.04   sec   281 KBytes  2.23 Mbits/sec  288
    [  4]   7.04-8.05   sec   277 KBytes  2.25 Mbits/sec  284
    [  4]   8.05-9.05   sec   274 KBytes  2.27 Mbits/sec  281
    [  4]   9.05-10.04  sec   273 KBytes  2.25 Mbits/sec  280
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
    [  4]   0.00-10.04  sec  3.15 MBytes  2.63 Mbits/sec  5.947 ms  375/3305 (11%)
    [  4] Sent 3305 datagrams
    
    iperf Done.

    iperf3 TCP :
    Code:
    perf3 -b 1Gbps -c ss.ss.ss.ss
    Connecting to host <SAMBA server>, port 5201
    [  4] local cc.cc.cc.cc port 63848 connected to ss.ss.ss.ss port 5201
    [ ID] Interval           Transfer     Bandwidth
    [  4]   0.00-1.01   sec  8.38 MBytes  69.5 Mbits/sec
    [  4]   1.01-2.00   sec  8.88 MBytes  75.1 Mbits/sec
    [  4]   2.00-3.00   sec  8.75 MBytes  73.5 Mbits/sec
    [  4]   3.00-4.00   sec  9.12 MBytes  76.4 Mbits/sec
    [  4]   4.00-5.01   sec  8.88 MBytes  74.1 Mbits/sec
    [  4]   5.01-6.01   sec  9.00 MBytes  75.6 Mbits/sec
    [  4]   6.01-7.01   sec  9.00 MBytes  75.1 Mbits/sec
    [  4]   7.01-8.01   sec  8.88 MBytes  74.9 Mbits/sec
    [  4]   8.01-9.01   sec  9.00 MBytes  75.1 Mbits/sec
    [  4]   9.01-10.00  sec  9.00 MBytes  76.2 Mbits/sec
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bandwidth
    [  4]   0.00-10.00  sec  88.9 MBytes  74.5 Mbits/sec                  sender
    [  4]   0.00-10.00  sec  88.9 MBytes  74.5 Mbits/sec                  receiver
    
    iperf Done.
    looks like Max~9 MBytes, can't explain why so low.
    Last edited by mike4ubuntu; April 29th, 2021 at 05:53 PM.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •