Repository navigation
Description
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+

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

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
mi-hol commentedon Feb 10, 2021
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
lsusbBus 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
iandk commentedon Feb 10, 2021
I've attached the output below.
At least one guy is experiencing the same issue.
mi-hol commentedon Feb 10, 2021
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)
iandk commentedon Feb 10, 2021
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.
iandk commentedon Feb 10, 2021
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.
popcornmix commentedon Feb 11, 2021
Can you test if the issue is samba related or network related?
E.g. measure network speed with iperf between the two machines?
iandk commentedon Feb 11, 2021
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.
s3b-s commentedon Feb 11, 2021
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:
RPI3 after 2 min playback:
popcornmix commentedon Feb 11, 2021
@dq-git your issue may be xbmc/xbmc#19147
d33pd1ve commentedon Feb 11, 2021
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
iandk commentedon Feb 12, 2021
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.
s3b-s commentedon Feb 12, 2021
@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.
jorensanbar commentedon Feb 15, 2021
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
jorensanbar commentedon Feb 15, 2021
New test: It is not the kernel, it is another update.
Continuous speed problem, after updating everything except the Kernel.

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

iandk commentedon Feb 15, 2021
Oh.. I was quite sure it’s related to the kernel.
I’ll have a look at the packages that will get updated
93 remaining items
jorensanbar commentedon Dec 8, 2022
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)
iandk commentedon Dec 9, 2022
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.
thedjswarm commentedon Dec 9, 2022
thedjswarm commentedon Dec 10, 2022
rigon commentedon Nov 17, 2023
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.
iandk commentedon Nov 27, 2023
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
name01019 commentedon Feb 11, 2024
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.
thedjswarm commentedon Feb 12, 2024
pelwell commentedon Feb 12, 2024
There's no lack of admission, it's the understanding that is absent. To repeat my comment from above:
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.
smgsmagus commentedon Mar 4, 2024
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.
geerlingguy commentedon Apr 3, 2024
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
smgsmagus commentedon Apr 3, 2024
I think it's for sure Samba issue, as for me
sudo systemctl restart smb.servicebrings 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+geerlingguy commentedon Apr 3, 2024
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).
anakinrpi commentedon Apr 3, 2024
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
geerlingguy commentedon Apr 3, 2024
@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).