Samba performance

30 19725
Ok, so here is the output of 'cat /proc/interrupts' when the display output is disabled as described above (adjusted Bananapi.fex):

There are no interrupts from sunxi lcd0, but it's still listed. This is, when you use the standard kernel config.

I also compiled a new kernel with an adjusted configuration with unnecessary drivers disabled (esp. graphics drivers for sunxi lcd and mali), then the output of 'cat /proc/interrupts' looks like this:
Personally, I prefer the standard kernel configuration and don't mind that the drivers are still loaded as long as there are no unnecessary interrupts.



Edited by Roy360 at Tue May 26, 2015 11:39

How are you guys getting 20+ mbps?

I rarely break 10MB/s on my setup. Would someone over 20MB/s mind uploading their image file?

Original Banana Pi
750GB 2.5" SATA WD Black HHD (main - powered by Pi)
Both the Pi and the test PC are on gigabit connections
Latest Bananian
Blackberry 1.8A Charger
Overclocked to 1.1GHz (1.2GHz freezes)
CPU Temps ~50 degrees celuis

Well, I cannot provide a full image, since my current installation is heavily customized (I use a newer Kernel 4.0 with recent U-Boot for example), so it would break any Bananian upgrade path. However, it should not be too hard, to achieve more than 20MB/s. When I first set up Bananian, I achieved more than 20MB/s even without any tweaking.

But I can share my latest smb.conf if that helps:
  1. [global]
  2. workgroup = HOME
  3. server string = BananaPi
  4. security = user
  5. load printers = no
  6. printing = bsd
  7. printcap name = /dev/null
  8. disable spoolss = yes
  9. log file = /var/log/samba/samba.log
  10. syslog = 0
  11. max log size = 100
  12. dns proxy = no
  14. use sendfile = yes
  15. aio read size = 16384
  16. aio write size = 16384
  17. map to guest = bad user
  18. max protocol = SMB2
  19. deadtime = 30
  20. usershare max shares = 0
  21. [Shared]
  22. path = /media/usbdisk/Shared/
  23. read only = no
  24. public = no
  25. writeable = yes
  26. valid users = username-a username-b
  27. create mask = 0660
  28. directory mask = 0770
Copy the Code
Maybe you can show us your configruation to check? Which samba version do you use? 3.6 or a newer version from the backports repository? How do you /etc/rc.local and /etc/sysctl.conf look like?

Edited by Roy360 at Tue May 26, 2015 15:20

CPU/Memory doesn't seem to be the problem

used 'sudo apt-get install samba samba-common-bin' to install samba yesterday
Samba Version 3.6.6 installed
Test Machine: Genuine Windows 8.1 64bit |i7 3820 + Realtek Gigabit LAN port + 32GB RAM

*********************Samba Config:**********************
netbios name =myDrive
server string = Samba file server
workgroup = workgroup
security = share
min receivefile size = 16384
socket options = TCP_NODELAY
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY
use sendfile = no
aio read size = 16384
aio write size = 16384
guest account = root

path = /media
read only = no
available = yes
browseable = yes
writable = yes
guest ok = yes
public = yes

hmm (doesn't look like the overclocks applied)
#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# remount filesystem with noatime flag
mount -o remount -o noatime /

# generate new ssh host key
if [ ! -f /etc/ssh/ssh_host_rsa_key ] || [ ! -f /etc/ssh/ ] ; then
        rm -f /etc/ssh/ssh_host_rsa_key*
        dpkg-reconfigure openssh-server

# cpu frequency
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1008000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy

exit 0

# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additonal system variables
# See sysctl.conf (5) for information.

#kernel.domainname =

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

# Functions previously found in netbase

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks

# Uncomment the next line to enable TCP/IP SYN cookies
# See
# Note: This may impact IPv6 TCP sessions too

# Uncomment the next line to enable packet forwarding for IPv4

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host

# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1


Your Samba config sped things up! (Goes up to 40MB/s!) Average speeds around 25MB/s

Anything I could do to make it even faster?

Edited by silentcreek at Wed May 27, 2015 10:35

Well, there are several things you can do. If you go back to the first two pages of this thread, you will find several sugestionss to tweak things. However, I would always recommend to try and test for yourself. From my experience, it is useless to just copy and paste everything because not all changes work work every scenario and sometimes even have negative impacts. So, test each measure you take and see if it really helps your usage.

1) Overclocking:
That certainly helps. But it's a decision you have to make. Be sure that your systems stays cool enough if you plan to overclok permanently. Personally, I did some experiments but I prefer not to overclock for the sake of heat management and long term-durability of the device.

2) Assigning interupts and affinity:
In the standard configuration request by the ethernet interface and the USB or SATA interface are handled by the first CPU core (CPU0). It helps if you manually change that so that, e.g. the ethernet requests are handled by the second core instead. Just add these lines to your rc.local file (the last line must stay "exit 0" so make sure to add stuff before that and not after):
  1. echo 2 > /proc/irq/$(cat /proc/interrupts | grep eth0 | cut -f 1 -d ":" | tr -d " ")/smp_affinity
  2. echo 2 > /sys/class/net/eth0/queues/rx-0/rps_cpus
  3. echo 2 > /sys/class/net/eth0/queues/tx-0/xps_cpus
Copy the Code
3) smb.conf
You could test omitting the max protocol = SMB2. That is something I added for better compatibility with an OS X client. You might not need that.

You could test different aio read/write sizes. I did some experiments last year, but my clients were mostly Windows 7 back then. Maybe different values will give you better performance.

If is often suggested to change the socket buffer sizes as you did with your original configuration (e.g. SO_RCVBUF=131072). For my usage I found it actualy had a very negative effect, so I don't use them. But maybe in your case that's different.

4) Network parameters
You can tweak the network parameters (buffer sizes and queue lenghts) as tkaiser suggests in post #9. Personally, I don't use these tweaks anymore after I found that with a newer kernel (4.0) they actually had an negative effect on my system. But with the old kernel (3.4), you may give it a shot.

5) Filesystem choice
It's worth mentioning that filesystems can have a performance impact. Especially NTFS requires considerably more CPU power, so by using a filesystem native to Linux, like ext4, you can reduce the CPU utilization and achieve better perforamance.

Aside from that: I would also recommend you to test with large files. The transfer speed is always a bit lower when you try to copy many small files instead of one or few large files. This way you get a better picture of the maximum performance than with just copying folders with many smaller files. Moreover, if you use really large files like 3GB or so, you can reduce the influence of caching in RAM and get a more realistic reading of your throughput.

Edited by Roy360 at Wed May 27, 2015 06:51
silentcreek replied at Wed May 27, 2015 03:34
Well, there are several things you can do. If you go back to the first two pages of this thread, you ...

1) Then I guess I'll just keep my overclock of 1.1GHz. According to my laser thermometer temps only get as high as 40 degrees. Which I translate to be max temp of 50.

2) According to htop, it's my Core 2 that's holding back my transfers

So I probably leave that setting to its default.

4) Hmm.. I already tried most of the tweaks here without first comparing without them. I wonder how I can undo them now.

5) Already using EXT4

In anycase, thanks for the help. 30MB/s is a huge improvement over the 7MB/s I was getting before.


When I offset the work to the 2nd core I get a constant 30MB/s. but when I don't I range between 20-40MB/s

Leaving interupts to core 0 seems to be the faster option for me.

I will note, that I get faster inconsistent writes (20-40) and lower consistent reads (~35) with this setup

Well, how did you apply the tweaks?
Basically all of the modifications layed out here have to be added to configuration files if you want to make them persistent. So if you, for example simply typed
  1. echo 1100000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Copy the Code
on the command prompt to set a new overclocked core speed, then this change is gone once you reboot the system (unlike the changes of the smb.conf file which are permanent unless you change that file again).

If you want to make it persitent, you have to add these to your /etc/rc.local file so they get executed on every boot. By looking at the files you posted earlier, it doesn't seem that you have applied any of these tweaks permanently. If you did make moodifications to rc.local or sysctl.conf then you can undo them by either deletend the lines or add a # at the beginning of the lines.

Edited by tkaiser at Wed May 27, 2015 07:43

Regarding SoC's temperature: If you use 'plain Bananian' in a recent version you can query the temperature probe inside A20's touchscreen controller using 'soctemp'.

Your obervation regarding cpu1 (you called it 'Core 2') seems wrong to me. Unless you manipulate the CPU affinity of specific processes the kernel's process scheduler assigns processes dynamically to 'free' CPU cores. So while you now might experience the smbd process in question being served by cpu1 this might change after assigning all eth IRQs to cpu0. Just give it a try dynamically (silentcreek's commands work also interactively and not just as part of /etc/rc.local) and revert the change when you're not satisfied. Some examples how CPU affinity and scheduler settings might influence performance here.

If you switch sometimes in the future to mainline kernel (4.x) then it might also give a slight performance boost in real-world scenarios by switching from ext4 to btrfs with the following mount options: "-o compress=lzo,noatime". In a 'single user' NAS scenario this will further increase performance since de/compression will be handled by the btrfs worker thread which will run most likely on a different CPU core than the smbd process.

May I ask for a little benchmark? I'm really interested in performance figures measured with Helios' LanTest. Could you please provide us with screenshot of the '300 MB' setup running against your Banana Pi? You'll find some infos as well as download link here:

Edited by tkaiser at Wed May 27, 2015 07:00
Roy360 replied at Wed May 27, 2015 06:36
Then I guess I'll just keep my overclock of 1.1GHz.

Please keep in mind that with the kernel you use (3.4) the cpufreq stuff has to be increased in steps of 48 MHz. Therefore setting 1100 will lead to 1056 instead. You would've to use 1104 if you want to achieve 1.1 GHz.


RE: Samba performance

Edited by hrip6 at Feb 25, 2017 08:41
silentcreek replied at Oct 09, 2014 16:19
..the fex modifications DO work. Following the fex guide from sunxi, I successfully disabled the display output.

Hi, I would like to turn off the display too and I found your post. However, I have no idea how to achieve your goal.
  • How to find that fex file to edit as your configurations?
  • How to edit that file? (Is Notepad++ enough?)
  • Does this improve performance of a headless server running Bananian?

Thank you so much.

You have to log in before you can reply Login | Sign Up

Points Rules