Skip to content

Degraded network performance after recent update #4133

Open

Description

@iandk

Describe the bug
I'm using a Pi 4 as a basic Samba share for several months now.
Recently after performing a system update & upgrade I noticed a degraded read and write performance.

It must be related to a recent update since otherwise, nothing has changed.
The write performance has dropped from a constant 113MB/s to around 75MB/s.

Since nothing else has changed in my setup I flashed an older build of Raspberry Pi OS ( 64bit was the only image I could find) to the Pi.
With this version, it's performing very well, just like the last few months.

But after running a system update && upgrade performance is significantly worse again.
The Samba version is exactly the same in both situations.

I guess it's related to the newer kernel and maybe some changes to the underlying network stack?

To reproduce
Configure a basic samba share on some external storage with an older version of Raspberry Pi OS.
I've used this build

After running a system update && upgrade the write performance is much lower than before.

Expected behaviour
More or less stable transfer at 100MB/s+
good

Actual behaviour
After a few seconds, the write speed to the Pi drops to around 75MB/s and stays there.
slow2

System

Raspberry Pi 4 2GB with Crucial MX500 attached via UASP USB3 adapter.
The disk is formatted as XFS and has trim support enabled.

WORKING
Linux raspberrypi 5.4.51-v8+ #1333 SMP PREEMPT Mon Aug 10 16:58:35 BST 2020 aarch64 GNU/Linux
Raspberry Pi reference 2020-08-20
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 7252c154838ec5b4576f29c996ac8fe3750cae12, stage4

Aug 19 2020 17:38:16
Copyright (c) 2012 Broadcom
version e90cba19a98a0d1f2ef086b9cafcbca00778f094 (clean) (release) (start)

NOT WORKING
Linux raspberrypi 5.10.11-v7l+ #1399 SMP Thu Jan 28 12:09:48 GMT 2021 armv7l GNU/Linux
Raspberry Pi reference 2021-01-11
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 21090519d85bdaa1615d5d5057d37b09368ea5d2, stage2
Jan 27 2021 22:19:57
Copyright (c) 2012 Broadcom
version 99d9a48302e4553cff3688692bb7e9ac760a03fa (clean) (release) (start)

Logs
No relevant output in dmesg or syslog

Additional context
I've tested it with three different drives, and two different Pis.
I also reinstalled Raspberry Pi OS several times, with nothing other than samba installed.
Therefore I'm 100% sure it's related to one of the updates.

The disk itself is performing well in both cases.

root@raspberrypi/home # dd if=/dev/zero of=test.data bs=4M count=1K
1024+0 records in
1024+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 13.0589 s, 329 MB/s

Activity

  1. mi-hol commented on Feb 10, 2021

    @mi-hol

    Could you please update your issue with details for the used UASP USB3 adapter from dmesg?
    Background:
    certain SATA2USB chipset & firmware versions seem to have bugs that impact performance negatively.

    example for detail I'm looking for (note: this device is not affected!)
    [ 3.013976] usb 2-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
    [ 3.045420] usb 2-2: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
    [ 3.053773] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
    [ 3.061033] usb 2-2: Product: IB-RD3662-C31
    [ 3.065324] usb 2-2: Manufacturer: ICY BOX
    [ 3.069496] usb 2-2: SerialNumber: 123456789100

    and output of lsusb
    Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge

  2. iandk commented on Feb 10, 2021

    @iandk
    Author

    I've attached the output below.
    At least one guy is experiencing the same issue.

    Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    [    1.793617] usb 1-1: new high-speed USB device number 2 using xhci_hcd
    [    1.976374] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.21
    [    1.976424] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
    [    1.976458] usb 1-1: Product: USB2.0 Hub
    [    1.979228] hub 1-1:1.0: USB hub found
    [    1.979571] hub 1-1:1.0: 4 ports detected
    [    2.124045] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
    [    2.137014] systemd[1]: System time before build time, advancing clock.
    [    2.155349] usb 2-1: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
    [    2.155393] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
    [    2.155427] usb 2-1: Product: Ugreen Storage Device
    [    2.155458] usb 2-1: Manufacturer: Ugreen
    [    2.155487] usb 2-1: SerialNumber: 091912070139
    [    2.182292] scsi host0: uas
    [    2.184443] scsi 0:0:0:0: Direct-Access     CT250MX5 00SSD1           0    PQ: 0 ANSI: 6
    [    2.187262] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/233 GiB)
    [    2.187500] sd 0:0:0:0: [sda] Write Protect is off
    [    2.187537] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
    [    2.187922] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    [    2.188686] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes
    [    2.235616]  sda: sda1
    [    2.238716] sd 0:0:0:0: [sda] Attached SCSI disk
    
  3. mi-hol commented on Feb 10, 2021

    @mi-hol

    Update 10Feb2021 16:49 UTC
    I've collected performance metrics using CrystalDiskMark previously and can NOT confirm a significant drop after upgrade to kernel 5.10.11 for my openmediavault based NAS
    (i.e. read of 64MB file increased from 93 MB/s to 109 MB/s) on the same hardware & setup (details (incl SAMBA config) here)

  4. iandk commented on Feb 10, 2021

    @iandk
    Author

    64MB file?
    You're not testing the throughput to your disk, you're testing your cache.

    Try again with a larger file and several read/ write operations.

  5. iandk commented on Feb 10, 2021

    @iandk
    Author

    I just tested it again.

    Flashed the newest Raspberry Pi OS 32bit version (still running the old 5.4.83-v7l+ Kernel ), configured a basic samba share and ran a few tests with around 10-20GB of data.
    No issues at all, the transfer speed was at 110MB/s all the time.

    After that, I updated to the kernel version 5.10.11-v7l+ and updated the preinstalled packages as well.
    I then ran exactly the same test again, nothing else changed.
    And the transfer speed dropped after around 3-4GB from 110MB/s to 75MB/s.

    This confirms that it's not related to a config issue or some other factor.
    I ran exactly the same test again, the only thing that has changed is the kernel version.

  6. popcornmix commented on Feb 11, 2021

    @popcornmix
    Collaborator

    Can you test if the issue is samba related or network related?
    E.g. measure network speed with iperf between the two machines?

  7. iandk commented on Feb 11, 2021

    @iandk
    Author

    It doesn't seem to be network related.
    iPerf shows a constant 950mbit/s in both directions.

    Edit: Samba itself shouldn't be the issue either, since the version hasn't changed with the update.

  8. s3b-s commented on Feb 11, 2021

    @s3b-s

    I am having a similar issue with my NFS shares that I am using for my kodi box. Everything was working just fine, but at the moment the video playback is impossible. My rpi4 is currently running: Linux 5.10.14-v7l+ #1401 SMP Mon Feb 8 14:27:07 GMT 2021 armv7l

    Before the update everything was working fine.
    I even turned on my old rpi3 board with :5.4.79-v7+ #1373 SMP Mon Nov 23 13:22:33 GMT 2020 armv7l and just copied over my /etc/exports. Suddenly kodi went back to life.

    Strangely enough, when accessing the share from my windows laptop, on both the video playback is smooth as butter.

    This is strange as for example iperf3 shows stable 900 Mb/s+.
    For a test I have played the same movie from both machines, while it played just fine from the RPI3 board, the RPI4 is just full of stutter and after a while it crushes.

    RPI4 nfsstat after 2min:

    Server rpc stats:
    calls      badcalls   badfmt     badauth    badclnt
    61554      0          0          0          0
    
    Server nfs v3:
    null             getattr          setattr          lookup           access
    7         0%     436       0%     0         0%     28117    45%     194       0%
    readlink         read             write            create           mkdir
    14        0%     32737    53%     0         0%     0         0%     0         0%
    symlink          mknod            remove           rmdir            rename
    0         0%     0         0%     0         0%     0         0%     0         0%
    link             readdir          readdirplus      fsstat           fsinfo
    0         0%     0         0%     39        0%     1         0%     8         0%
    pathconf         commit
    
    

    RPI3 after 2 min playback:

    Server rpc stats:
    calls      badcalls   badfmt     badauth    badclnt
    1698       0          0          0          0
    
    Server nfs v3:
    null             getattr          setattr          lookup           access
    1         0%     5         0%     0         0%     97        5%     3         0%
    readlink         read             write            create           mkdir
    0         0%     1589     93%     0         0%     0         0%     0         0%
    symlink          mknod            remove           rmdir            rename
    0         0%     0         0%     0         0%     0         0%     0         0%
    link             readdir          readdirplus      fsstat           fsinfo
    0         0%     0         0%     2         0%     0         0%     1         0%
    pathconf         commit
    0         0%     0         0%
    
    
  9. popcornmix commented on Feb 11, 2021

    @popcornmix
    Collaborator

    @dq-git your issue may be xbmc/xbmc#19147

  10. d33pd1ve commented on Feb 11, 2021

    @d33pd1ve

    I have the same problem with my Pi 4 4GB!

    I use it as a NAS with an 8TB WD Elements attached.
    Performance is much lower after the recent updates

  11. iandk commented on Feb 12, 2021

    @iandk
    Author

    This is also the second time I'm noticing IO errors after the kernel update.
    I've never seen this issue in the past 6 months with the old kernel.

    [59761.546841] sd 1:0:0:0: [sdb] Attached SCSI disk
    [152744.813849] XFS (sda1): log I/O error -5
    [152744.813945] XFS (sda1): xfs_do_force_shutdown(0x2) called from line 1196 of file fs/xfs/xfs_log.c. Return address = 78401cd3
    [152744.813963] XFS (sda1): Log I/O Error Detected. Shutting down filesystem
    [152744.813996] XFS (sda1): Please unmount the filesystem and rectify the problem(s)
    
  12. s3b-s commented on Feb 12, 2021

    @s3b-s

    @popcornmix Thanks, it looks like this is just the case here. Meanwhile I reverted kernel to the same that was working on rpi3 and magic happened, everything works now.

  13. jorensanbar commented on Feb 15, 2021

    @jorensanbar

    Same bug.

    Upgrated to kernel 5.10.11 speed: 70 MB/s.
    ​
    Returning to 5.4.79-v71+ #1373, speed: 115 MB/s

    Pi 4B 2GB + WD Elements 5TB USB 3.0

  14. jorensanbar commented on Feb 15, 2021

    @jorensanbar

    Upgrated to kernel 5.10.11 speed: 70 MB/s.

    New test: It is not the kernel, it is another update.

    Continuous speed problem, after updating everything except the Kernel.
    Captura de pantalla 2021-02-15 120110

    My OMV, is working with an old kernel, and after updating everything else, the problem starts.
    Updates

  15. iandk commented on Feb 15, 2021

    @iandk
    Author

    Oh.. I was quite sure it’s related to the kernel.
    I’ll have a look at the packages that will get updated

  16. 93 remaining items

  17. jorensanbar commented on Dec 8, 2022

    @jorensanbar

    Having same issue, except I'd kill for 70mb/s, only getting 10-12 mb/s.

    Are you using USB Devices?

    Use this command in terminal: lsusb -t

    This shows you the way the device was connected, all should be at minimum USB 3.0 to take advantage of the speed (5000M)

    imagen

  18. iandk commented on Dec 9, 2022

    @iandk
    Author

    Gave it another try, even when overclocking to the max it’s still showing the same issue.
    I can also confirm it’s not related to the SMB implementation in windows as macOS shows the exact same problems.

  19. thedjswarm commented on Dec 9, 2022

    @thedjswarm
  20. thedjswarm commented on Dec 10, 2022

    @thedjswarm
  21. rigon commented on Nov 17, 2023

    @rigon

    Version 12 Bookworm is out, but no changes in this regard.

    Occurred to me trying different services for sharing files, like NFS and KSMBD (now available on bookworm, it's a kernel module that implements a SMB server, is replacement of samba and promises better performance).

    However I got very similar results using the 3 services, around 60MB/s reads.
    In the meantime, I got 100MB/s using samba on buster reading the same files.

  22. iandk commented on Nov 27, 2023

    @iandk
    Author

    I tested it with Bookworm on a Pi 5.
    Write speed is fine and pretty much constant at 110MB/s

    But read speed varies quite a lot (80-100MB/s).
    I think there's still some sort of bug affecting the read performance as the Pi 5 should definitely be capable of a higher sustained read speed

  23. name01019 commented on Feb 11, 2024

    @name01019

    I am experiencing the same issue as well.

    OS - Bullseye
    Hardware - Raspberry Pi 4

    Drives formatted to ext4
    Read speeds over wired ethernet - 30 MB/s
    Write speeds over wired ethernet - 112 MB/s

    I used to be able to read at around 100+ MB/s, but at some point along the update cycle, this drastically changed.

  24. thedjswarm commented on Feb 12, 2024

    @thedjswarm
  25. pelwell commented on Feb 12, 2024

    @pelwell
    Contributor

    There's no lack of admission, it's the understanding that is absent. To repeat my comment from above:

    There's been no progress on our end - without some insight to guide the investigation we are unlikely to invest any more effort into it.

    Feel free to point us to the analysis that somebody has done on this open source software clearly demonstrating the cause of the slow down - memory fragmentation, solar storms, etc. - and we'll apply any available fix.

  26. smgsmagus commented on Mar 4, 2024

    @smgsmagus

    Same here, pi4, 64bit with Linux 6.1.0-rpi8-rpi-v8. I'm not able to hunt it down what causes this issue, but I'm sure I can reproduce it. Like the others the last version which was working fine was 5.4.79-v71+. But... this specific problem does not happen always. For example few hours back I had this problem with around 80MB/s read from pi, even connected my laptop via ethernet to check, but was the same. Then I restarted smb service few times and speeds are now back to normal (105-110MB/s). Noticed it also earlier that if you recycle smb few times, then it sometimes goes back to normal state and stay for a longer time being fine.

    if you have suggestion on what to check - happy to do that

    edit: got hit again, this time limited to 60MBs. Restarted smbd - back to normal.

  27. geerlingguy commented on Apr 3, 2024

    @geerlingguy

    I'm doing a little investigation with Pi 5 as well, because I figure SMB should be able to hit at least a gigabit reliably writing to the Pi if the disks are fast enough... which I've had the same issue with 900 MB/sec NVMe and SATA SSDs now, so I don't think it's storage or the PCIe bus, but something in networking or Samba.

    I'm doing some testing in this issue: geerlingguy/raspberry-pi-pcie-devices#615

  28. smgsmagus commented on Apr 3, 2024

    @smgsmagus

    I'm doing a little investigation with Pi 5 as well, because I figure SMB should be able to hit at least a gigabit reliably writing to the Pi if the disks are fast enough... which I've had the same issue with 900 MB/sec NVMe and SATA SSDs now, so I don't think it's storage or the PCIe bus, but something in networking or Samba.

    I'm doing some testing in this issue: geerlingguy/raspberry-pi-pcie-devices#615

    I think it's for sure Samba issue, as for me sudo systemctl restart smb.service brings back speeds to normal, but only for few hours/day and then it runs into 60-70ish MB/s levels again after some time. After restart it's back to 100MB/s+

  29. geerlingguy commented on Apr 3, 2024

    @geerlingguy

    I've been measuring with large file copies 50-100 GB in size, and for the first few seconds, all copies start off around 115 MB/sec, then they start going up and down between 50-110 MB/sec, averaging about 70 MB/sec with ZFS RAIDZ1 (96 MB/sec on mdadm RAID 0).

    I tried rebooting the Pi and quickly starting the copy, I tried letting it run for 30 minutes, doing a copy, then restarting smbd and trying the copy again, makes no difference on this Pi at least (Pi 5 8 GB RAM).

    I'm digging into samba settings too, to see if there are any other tweaks that could help, or performance monitoring tools that could find where the bottleneck is (could even be client side... need to spin up a few containers and run through Linux too, not just macOS).

  30. anakinrpi commented on Apr 3, 2024

    @anakinrpi

    I got around 100/110 MB/s by modifying smb.conf in the aio read size and aio write size part, setting it to 0. This is my smb.conf:
    socket options = TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT
    guest account = nobody
    load printers = no
    disable spoolss = yes
    printing = bsd
    printcap name = /dev/null
    unix extensions = yes
    wide links = no
    use sendfile = yes
    aio read size = 0
    aio write size = 0
    time server = no
    wins support = no
    disable netbios = yes
    multicast dns register = no
    min receivefile size = 16384
    getwd cache = yes

  31. geerlingguy commented on Apr 3, 2024

    @geerlingguy

    @falacu - I tried that, restarted everything, and it's still giving me the inconsistent speeds on macOS — apparently it's giving me good, consistent 110 MB/sec speed over in Windows 11, so at this point, I'm trying to see what about Apple's implementation could be breaking things (see the issue I linked earlier, I've been spelunking pretty deep).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions