Horrible transfer speed in Samba shares

I’m getting horrible transfer speeds in Samba, it maxes around 750 KiB/s but varies wildly throughout, the connection even drops out sometimes.

This is on a dedicated server with a gigabit uplink, and other services like HTTP and SSH are not affected in the same way, they are able to provide much faster transfer speeds over the same network.

I’m using Tailscale VPN to access it because it’s an internal non-public facing service.

I’ve been trying to figure out the issue for a couple of days now but I can’t find anything unusual, I even tried Wireshark to see if there was anything off but I did not see anything like that.

Any help is greatly appreciated!

Edit: I forgot to mention this initially but each “operation” takes a significant amount of time over SMB. By operation I mean anything which makes the OS query the file (could be a simple stat or a file read), so even navigating around is painful, especially when a directory has a lot of files! It causes programs (E.g. file manager (thunar), video player (mpv), shell (fish) etc.) to jam up and become unresponsive quite frequently.

is the Samba server dedicated or virtual?

Thanks for replying!

It’s the vanilla samba daemon which ships with Rocky via the official repos, so I guess the answer here would be dedicated… it’s certainly not inside a virtual machine of any kind.

I followed your suggested links, the first one did not reach any conclusion but I did try checking the CPU usage during a file transfer and I saw nothing unusual, there was little to no difference.

I already followed the performance best practices article from Tailscale, the remote machine and my machine have a direct connection with optimal conditions.

I wasn’t sure what I could do with the info in the Microsoft website, it used Windows-exclusive tools. I am using Linux on both ends, Rocky on the server and Arch on the client.

To rule out that the issue might’ve been caused by the VPN itself I tested the transfer speeds via a direct IP connection and somehow that made things worse! The speed now maxes out around 200 KiB/s!

I also forgot to mention this in the original post but each “operation” takes a significant amount of time over SMB, by operation I mean anything which makes the OS query the file (could be a simple stat or a file read), so even navigating around is painful, especially when a directory has a lot of files!

I was hoping that the Microsoft article might have some generic clues, including at the top of their web page when they wrote: " [SMB signing] and [SMB encryption] are known to slow down SMB transfers. The amount of the performance loss depends greatly on the capabilities of the hardware involved. The primary factors are the count and speed of the CPU core, and how much CPU time is dedicated to other workloads." But you subsequently wrote that you don’t see high CPU usage, so probably not that.

This old web page says adjusting the buffers can quantitatively improve performance Reddit - Dive into anything

This old web page says that if the Log Level is higher than 2, you might suffer a large drop in performance Chapter 45. Samba Performance Tuning which would apply in both your VPN and Direct scenarios.

1 Like

I agree, probably not that.

It looks promising, will try this soon.

Right, and I did check that, the default is 0 and I’m using the defaults so that’s not the issue.