BananaPi as a fileserver -- some personal thoughts and experiences.

12 21018
Edited by tkaiser at Wed Nov 12, 2014 04:39

Just a small follow-up for "single user NAS" use cases. In this special scenario when just one network client wants to use the services of the Banana Pi then one can manipulate scheduler settings as well as assign specific tasks to dedicated CPU cores.

In my setup I delegated all network interrupts to CPU 1 (the remaining stuff will be processed on CPU 0 since IRQ balancing seem not work on armhf) and made some experiments with ionice and taskset (assigning specific processes to specific CPU cores):

The taskset default is 03 (using all available CPU cores) but I got the best results when I set the CPU affinity to 1 (means CPU 0). Playing with ionice and therefore process scheduler settings will probably only have noticeable effects when the system is busy doing other tasks.

In my scenario (using OS X as client and Netatalk as AFP server) I manipulated the settings of the three processes responsible for doing file services (Netatalk/AFP is not just a file server but has also an integrated database daemon to maintain ID <--> path relationsships for every file and directory inside a sharepoint). In case you're using eg. Samba you have to adjust the settings of the smbd process serving the specific client. Therefore these settings can't be applied at startup time when only the master smbd process is running but have to be adjusted at runtime when the client is already connected and the PID of the forked smbd process serving the client is known.

My processes had the process IDs 1890, 3168 and 3170 so I simply adjusted this as root:
  1. for i in 1890 3168 3170 ; do
  2.         taskset -p 01 $i && ionice -c1 -p $i
  3. done
Copy the Code
This is stuff for eg. crontab running every minute. If for example the client in question authenticates as user 'john' and one wants to adjust CPU affinity and/or scheduler settings of the specific smbd process then something like this in crontab would do the magic (but the results below show that you better not touch the scheduler stuff and do not use '; /usr/bin/ionice -c1 -p $JohnsPID'):
  1. JohnsPID=$(/bin/ps auxww | /bin/grep smbd | /usr/bin/awk -F" " '/^john/ {print $2}') && /usr/bin/taskset -p 01 $JohnsPID ; /usr/bin/ionice -c1 -p $JohnsPID
Copy the Code
You get these few MBytes/sec for free if the Banana Pi is just serving one user and not many (in the latter case it's way better to rely on the defaults regarding scheduler settings and CPU affinity)

taskset -p 01 $i && ionice -c1 -p $i:

taskset -p 02 $i && ionice -c1 -p $i:

taskset -p 01 $i && ionice -c2 -p $i:

taskset -p 01 $i && ionice -c1 -p $i:

taskset -p 03 $i && ionice -c2 -p $i:

taskset -p 01 $i && ionice -c2 -p $i:

Which OS do you use?
I use the Ubuntu distro for my pi, and I can only get my network speed at around 300Mb/s im using iperf for monitoring.

I had tweaked my network setting and cpu0 to be used primarly for network.
Now I get speeds at around 830Mb/s - I think it's good without OC.
My read speed on a sata disk i around 43MB/s and write speed is around 10MB/s.

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

Points Rules