Bananian

SATA slow transfer

5 1374
AlexY  
Edited by AlexY at Jun 02, 2016 22:51

On my Banana Pi command:
  1. hdparm -tT /dev/sda
Copy the Code
executed several times giving results:

  1. /dev/sda:
  2. Timing cached reads:     2 MB in  4.28 seconds = 478.01 kB/sec
  3. Timing buffered disk reads:   4 MB in  3.37 seconds =   1.19 MB/sec

  4. /dev/sda:
  5. Timing cached reads:     2 MB in  4.31 seconds = 474.66 kB/sec
  6. Timing buffered disk reads:   2 MB in  4.29 seconds = 477.89 kB/sec

  7. /dev/sda:
  8. Timing cached reads:   852 MB in  2.00 seconds = 425.50 MB/sec
  9. Timing buffered disk reads:   4 MB in  6.28 seconds = 652.72 kB/sec

  10. /dev/sda:
  11. Timing cached reads:   854 MB in  2.00 seconds = 426.60 MB/sec
  12. Timing buffered disk reads:   4 MB in  3.69 seconds =   1.08 MB/sec

  13. /dev/sda:
  14. Timing cached reads:   842 MB in  2.00 seconds = 420.27 MB/sec
  15. Timing buffered disk reads: 256 MB in  3.01 seconds =  84.97 MB/sec

  16. /dev/sda:
  17. Timing cached reads:     2 MB in  4.22 seconds = 484.88 kB/sec
  18. Timing buffered disk reads:   2 MB in  4.28 seconds = 478.03 kB/sec
Copy the Code
As you can see once there was proper transfer rate, usually it is very low. Average transfer over samba on gigabit LAN is ~25MB/s, FTP ~40MB/s this is quite disappointing, CPU load is low with average 0.09 - 0.4 , memory usage very low, HDD is Seagate Barracuda 1.5TB, on PC works properly, what can I check, how can I diagnose where lies the problem?

Edited by danger89 at Jun 15, 2016 13:38

Instead of posting links, which is NOT really helpful (we need to read all the posts again and the out-come )... I like to have some clear best practices what helps everyone.

@AlexY Did you try to use the latest mainline kernel (version 4.x) with Bananian? Instead of the old 3.4 kernel.
On Bananaian 16.04 just install the kernel metapackage “linux-image-4.4-bananian” to get the latest 4.x kernel. On older releases use aptitude search 'linux-image-(.*)-bananian' to show them, 'aptitude install' to install a mainline kernel.

The bootmanager automatically boots mainline kernel (4.x) when installed. If you like to go back to 3.4, use bananian-config.

On the dual-core A20 (that is the processor used for the Banana Pi) setting both CONFIG_SCHED_MC=y and CONFIG_SCHED_SMT=y at kernel compile time seems to increase SATA throughput (sequential reads +10 MB/s).  I found this on the Sunxi manufacturer page. But since the kernel is already compiled I hope Bananian did use this flags... You can list the kernel flags where the current kernel was compiled with via:
  1. cat /boot/config-`uname -r`
Copy the Code
So execute:
  1. grep CONFIG_SCHED_MC /boot/config-`uname -r`
Copy the Code
And:
  1. grep CONFIG_SCHED_SMT /boot/config-`uname -r`
Copy the Code
The same webpage also explain to look at the I/O schedulers under Linux:
  1. echo deadline >/sys/block/sdN/queue/scheduler
Copy the Code
deadline seems to be the most performant scheduler on A10/A20 . To make it persistent add the line to the /etc/rc.local file for a single disk (sdN).

I don't know how valid the improvement listed below is (since we got the kernel 4.x), but you also could try to assign all AHCI/SATA IRQs to the second CPU core using:
  1. echo 2 >/proc/irq/$(awk -F":" '/ahci/ {print $1}' </proc/interrupts)/smp_affinity
Copy the Code

Good luck!

Kind regards,
Melroy van den Berg

AlexY  
Edited by AlexY at Jul 18, 2016 21:01

First - sorry for delay but I came here only when have problem I can't solve, and apparently there is no email notification about reply to my posts.
I tried actually everything from threads in links from actkk2000 without any success or with just cosmetic result.
My current kernel is
3.4.108-bananian
CONFIG_SCHED_MC=y
CONFIG_SCHED_SMT=y
Tested 4.3.3
both config flags are the same
Transfer improved by around 15MB/s for samba, almost no change for FTP, it seems this is limit of SoC chip so I will leave it like that for now. Later on will try to recompile with SMT flag reset.
Thank you Melroy for the direction.

igorpec  

AlexY  
I saw this, good source of info especially tuning section but to be honest I'm not after creating an NAS just samba server but fast enough to copy several GB movie within x minutes not xx minutes
So far kernel 4.3.3 is ok except fu#@%ed /sys so my scripts monitoring power consumption and temperature don't work any more and I can't find where (and FFS) devs moved entries I use.

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

Points Rules