Tuesday 25 November 2014

Banana Pi USB 2.0 'Gigabit' Ethernet Adapter throughput test

Banana Pi USB 2.0 'Gigabit' Ethernet Adapter throughput test

I bought a cheap USB 2.0 to Gigabit Ethernet Adapter (Maximum Data Transfer Rate 480 Mbps according to the website), mostly because I wanted to see how it performed on a Raspberry Pi, so now I'm running the same tests on my new board the Banana Pi. It can never reach 480Mbps, but it will be interesting to see how much throughput it can actually achieve.

As usual, I have censored any identifying information about my local network or personal hardware.

Hardware Configuration:

Banana Pi
RAM 1024MB
no overclocking
Inbuilt 10/100/1000 NIC is not connected.
Top USB port has USB 2.0 to Gigabit Ethernet Adapter plugged in and plugged.into router
Bottom USB port is empty





      
+---+  +------+         +------+           +----------------+
|BPi|->|USB2.0|->1Gbps->|router|->200Mbps->|Remote webserver|
+---+  +------+ Ethernet+------+ Internet  +----------------+
      
480Mibps             |
                         1Gbps Ethernet
                            |
                            v
                     +-------------+
                     |LAN webserver|
                     +-------------+


Software Configuration: 

I had to add in an extra three lines for this new USB eth1 NIC to get it working on the Banana Pi, the lines in bold below.

root@bananapi ~ # cat /etc/network/interfaces
allow-hotplug eth1
auto lo
iface lo inet loopback
auto eth0
 
iface eth0 inet dhcp
auto eth1 
iface eth1 inet dhcp

root@bananapi ~ #

root@bananapi ~ # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0424:7500 Standard Microsystems Corp. LAN7500 Ethernet 10/100/1000 Adapter
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@bananapi ~ # lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=sw-ohci/1p, 12M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=sw-ehci/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=smsc75xx, 480M

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=sw-ohci/1p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=sw-ehci/1p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=sw_hcd_host0/1p, 480M

root@bananapi ~ # ethtool eth1
Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Half 1000baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full

        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
root@bananapi ~ #

root@bananapi ~ # netstat -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             4      0      0      0 BMU
eth1       1500 0       457      0      0 0           485      0      0      0 BMRU
lo        16436 0         1      0      0 0             1      0      0      0 LRU
root@bananapi ~ #

root@bananapi ~ # ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 80:3f:5d:**:**:**
          inet addr:
*.*.*.*  Bcast:*.*.*.*  Mask:*.*.*.* 
          inet6 addr: fe80::823f:5dff:fe08:69ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:470 errors:0 dropped:0 overruns:0 frame:0
          TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:37207 (36.3 KiB)  TX bytes:72520 (70.8 KiB)

root@bananapi ~ #

Internet Test (via a 200Mbit/sec broadband connection)


Download a single 100MiB file to the Pi through the USB 2.0 Gigabit Ethernet Adapter and send the downloaded data to /dev/null.

root@bananapi ~ # time wget http://qrng.physik.hu-berlin.de/files/speedtest-100MB.bin -O /dev/null
--2010-01-01 00:17:55--  http://qrng.physik.hu-berlin.de/files/speedtest-100MB.bin
Resolving qrng.physik.hu-berlin.de (qrng.physik.hu-berlin.de)... 141.20.41.134
Connecting to qrng.physik.hu-berlin.de (qrng.physik.hu-berlin.de)|141.20.41.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: ‘/dev/null’

/dev/null                                           100%[=====================================================================================================================>] 100.00M  11.4MB/s   in 16s

2010-01-01 00:18:11 (6.21 MB/s) - ‘/dev/null’ saved [104857600/104857600]

wget http://qrng.physik.hu-berlin.de/files/speedtest-100MB.bin -O /dev/null  0.25s user 2.22s system 14% cpu 16.559 total
root@bananapi ~ #

LAN Test

Download a single 100MiB file to the Pi through USB 2.0 Gigabit Ethernet Adapter and send the downloaded data to /dev/null. The data source is on the Local network from a machine with a 1 Gbit/sec NIC patched directly into the router with the data being read from a RAM disk to maximise read speed.
root@webserver:~# apt-get install nginx nginx-common nginx-full
root@webserver:~# /usr/sbin/nginx &
root@webserver:~# mkdir /usr/share/nginx/www/ramdisk
root@webserver:~# chmod 777 /usr/share/nginx/www/ramdisk
root@webserver:~# free -m
root@webserver:~# mount -t tmpfs -o size=256M tmpfs /usr/share/nginx/www/ramdisk
root@webserver:~# cp speedtest-100MB.bin /usr/share/nginx/www/ramdisk


root@bananapi ~ # time wget http://*.*.*.*/ramdisk/speedtest-100MB.bin -O /dev/null
--2014-11-20 21:10:47--  http://
*.*.*.*/ramdisk/speedtest-100MB.bin
Connecting to
*.*.*.*:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: ‘/dev/null’

/dev/null                                           100%[=====================================================================================================================>] 100.00M  39.5MB/s   in 2.5s

2014-11-20 21:10:50 (39.5 MB/s) - ‘/dev/null’ saved [104857600/104857600]

wget http://
*.*.*.*/ramdisk/speedtest-100MB.bin -O /dev/null  0.24s user 1.60s system 71% cpu 2.572 total
root@bananapi ~ #


Results
Peak Internet transfer rate 10.87MiB/sec (91.2Mbps) - about 13 hops away
Average Internet throughput 6.04MiB/sec - about 13 hops away.

Because this server is so many hops away it's throughput varies wildly with time of day and is effected by so  many uncontrolled fluctuations on every hop in between. This result is more an example of a typical Internet based throughput than a maximum throughput.




Peak LAN download transfer rate 38.88 MiB/sec (326.15Mbps) - for 1000Mbps (even limited to USB 2.0 480Mbps) this is a very good throughput.
Average LAN download throughput 38.88 MiB/sec - for 1000Mbps (even limited to USB 2.0 480Mbps) this is a very good throughput.

I'm very pleased with the USB 2.0 Gigabit Ethernet Adapter result for the Banana Pi. I was expecting a result somewhere between 20 MiB/sec and 40 MiB/sec. 


I enabled jumbo frames ("sudo ifconfig eth1 mtu 9000") on the webserver and on the Banana Pi to see if I could get a better result, but I couldn't get it to work. I'm not quite sure why, yet but I'm still looking into it.

Additional testing

I decided to try the test in reverse. Install a webserver on the Banana P, and make a 128MiB ramdisk to download a file from the Banana Pi through USB 2.0, through the USB 2.0 Gigabit Ethernet Adapter down to the midrange PC with a Gigabit NIC, and then throw the data away.
root@bananapi ~ # apt-get install nginx
root@bananapi ~ # mkdir /var/www/html/ramdisk
root@bananapi ~ #  chmod 777 /var/www/html/ramdiskroot@bananapi ~ #  free -m 
root@bananapi ~ #  mount -t tmpfs -o size=128M tmpfs /var/www/html/ramdisk
root@bananapi ~ #  cp speedtest-100MB.bin /var/www/html/ramdisk

midrangepc $ time wget http://*.*.*.*/ramdisk/speedtest-100MB.bin -O /dev/null
--2014-11-20 22:39:33--  http://
*.*.*.*/ramdisk/speedtest-100MB.bin
Connecting to
*.*.*.*:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: `/dev/null'

100%[=================================================================================================================================================================>] 104,857,600 19.8MB/s   in 5.1s

2014-11-20 22:39:38 (19.7 MB/s) - `/dev/null' saved [104857600/104857600]


real    0m5.075s
user    0m0.268s
sys     0m1.592s
midrangepc $





Average LAN upload throughput 19.6 MiB/sec (156.8Mbps)

I'm not quite sure why upload is always less than download throughput rates, it is something that I'll have to think about for a while.

For two final tests I decided to unplug the USB 2.0 Gigabit ethernet adapter and use the Banana Pi's actual builtin Gigabit NIC and just get the average throughput in each direction (using a ramdisk on each machine to upload the file from as fast as possible).

Midrange server as the webserver: 101 MB/s (Banana Pi as the client, running wget) [808Mbps 96.3MiB/sec]
Banana Pi as the webserver: 71.5 MB/s (Midrange PC server as the client, running wget) [572Mbps 68.2MiB/sec]



Thursday 20 November 2014

Comparison of Raspberry Pi vs Beaglebone Black vs Banana Pi

Update (2015-2): I'll update the below when I get more info on the new BCM2836 chip used in the Raspberry Pi Generation 2 model B. It CPU performance should jump up by about six, the RAM has doubled, but the GPU is the same as is everything else. RAM performance will be the same, no clocking improvement, just size. The quad core CPU (ARMv7) does now have NEON support so SIMD, should improve data processing ability. But the real bottleneck to the RPi is getting data into and out of the CPU from the real world, it is like a giant head sitting on a straw.


CPU

From each of the /proc/cpuinfo files shown below, in theory if an application is single threaded the Banana Pi should win, and if it is multithreaded the Banana Pi should still win. I have not run any direct benchmark, just looking at the BogoMIPS and the Features supported by each ARM chip.

Raspberry Pi (Model A,B,B+,A+ all have the same ARM1176JZF-S)
------------
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000f

BeagleBone Black
----------------
processor    : 0
model name    : ARMv7 Processor rev 2 (v7l)
BogoMIPS    : 990.68
Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x3
CPU part    : 0xc08
CPU revision    : 2

Hardware    : Generic AM33XX (Flattened Device Tree)
Revision    : 0000
Serial        : 0000000000000000


Banana Pi (The Banana Pro has the same Allwinner A20)
---------
Processor       : ARMv7 Processor rev 4 (v7l)
processor       : 0
BogoMIPS        : 2004.17

processor       : 1
BogoMIPS        : 2011.05

Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 4

Hardware        : sun7i
Revision        : 0000



Video/GPU


Raspberry Pi:  Broadcom VideoCore IV (Graphics and compute) 24 GFLOPS
Beaglebone Black: PowerVR SGX530 (200 MHz) (Graphics, video encoding, decoding only) 1.6 GFLOPS
 Banana Pi: ARM Mali400MP2 dual GPU core (Grahpics, video encoding, decoding only) 6.3 GFLOPS 


RAM


Raspberry Pi ( A, A+, B rev 1): 256MiB DDR
Raspberry Pi (B rev 2, B+): 512MiB DDR
BeagleBone Black: 512MiB DDR3L
Banana Pi: 1024MiB DDR3

[DDR3 is 1.35 volt and DDR3L 1.25 volt (lower power = less heat = longer life)]

 

USB


Raspberry Pi A: 1 x Standard A host port (direct).
Raspberry Pi B: 2 x Standard A host port (via hub with Ethernet).
Raspberry Pi A+: 1 x Standard A host port (direct).
Raspberry Pi B+: 4 x Standard A host port (via hub with Ethernet).
Beaglebone Black: 1 x Standard A host port (direct) 1x mini B device port (direct)
Banana Pi: 2 x Standard A host port (direct) 1x mini AB OTG port (direct)
 

Ethernet

Raspberry Pi (B, B+): 10/100Mbps (shared USB)
Beaglebone Black: 10/100Mbps
Banana Pi: 10/100/1000Mbps

Storage


SD/microSD

Raspberry Pi A,B: SD card
Raspberry Pi A+, B+:  microSD card
Beaglebone Black:  microSD card
Banana Pi:  SD card

8-bit eMMC 

Raspberry Pi: None
Beaglebone Black ((Rev B): 2 GB Ångström pre-installed
Beaglebone Black ((Rev C): 4 GB Debian pre-installed
Banana Pi: None

SATA

Raspberry Pi: None
Beaglebone Black: None
Banana Pi: SATA 2.0

Me personally I hate devices with inbuilt flash, 3000-5000 writes per block and the device ready for the bin.


GPIO/Low-level peripherals

Raspberry Pi A, B rev 1: UART, SPI, 2x I²C,MIPI CSI-2, (not yet enabled DSI, CEC)
                                       8-17GPIO pins
Raspberry Pi B rev 2: UART, SPI, 2x I²C,MIPI CSI-2, (not yet enabled DSI, CEC)
                                  12-21GPIO pins

Raspberry Pi A+, B+: UART, SPI, 2x I²C,MIPI CSI-2, (not yet enabled DSI, CEC)
                                   EEPROM ID feature for auto-configuration with add-on "HAT" boards
                                   21-30GPIO pins

Beaglebone Black: 4xUART(1xTX only), 8x PWM, LCD, GPMC, MMC1, 2x SPI, 2x I²C, 7xADC(1.8v), 2x CAN bus, 4 Timers, 25xPRU
                                  65 GPIO pins
Banana Pi:  UART, SPI, I²C, CAN, ADC, PWM
                  CSI (or 21 additional GPIO pins), LCD display LVDS (or 36 additional GPIO pins)
                  7-17 GPIO pins (or 7-74 GPIO pins if CSI and LCD are re-purposed)
                  IR receiver
                  On board microphone

Overall I'd probably pick the Beaglebone Black as having the best GPIO/Low-level peripherals support (and very easy access to the pins).


Power

Raspberry Pi A: 500mA-1000mA
Raspberry Pi B: 700-1000mA
Raspberry Pi A+:  500mA-2000mA
Raspberry Pi B+: 600-2000mA
Beaglebone Black: 300–500 mA @5 V
Banana Pi: 200mA*-2000mA (*requires 700-800mA during boot)


Weight

Raspberry Pi A:  45 g (1.6 oz)
Raspberry Pi B:  45 g (1.6 oz)
Raspberry Pi A+:   23 g (0.81 oz)
Raspberry Pi B+:  45 g (1.6 oz)
Beaglebone Black: 39.68 g (1.400 oz)
Banana Pi:  48 g (1.7 oz)



My conclusion would be if it is light weight I needed, then I'd go with a Pro Trinket (2.6g/0.09oz), unless I needed a 1920x1080HD camera as well then it would be the Raspberry Pi A+ (23g/0.81oz) with a camera module (3g/0.11oz). If it was easily accessible GPIO that I needed, with loads of inputs and outputs I'd pick the Beaglebone Black (It is a great piece of open hardware) 7ADC is nice. And finally if it was shoving large amounts of data about fast, or processing that data, I'd pick the Banana Pi (With SATA 2.0, Gigabit Ethernet and 1GiB of RAM it is an impressive piece of kit) or it's newer incarnation of hardware the Banana Pro (with builtin WiFi).

There are larger communities built up around the Raspberry Pi and Beaglebone Black, than there is around the Banana Pi/Pro hardware.  So if you have a problem, sometimes you may have to solve it yourself rather than looking for a quick fix from someone else in the community  who had the same problem already.

Wednesday 12 November 2014

Banana Pi SATA 2.0 disk throughput test

Hardware Configuration:

Banana Pi-M1 1024MiB RAM, no overclocking
Inbuilt 10/100/1000 NIC is connected.
Top USB port is empty.
Bottom USB port is empty.
SATA disk connected via SATA cable to SATA port on BPi.
Harddisk is power from an external supply (R-Driver III).
No keyboard and no mouse.

The HDD that I'm using has an Internal write rate of about 100MiB/sec, so it is not a great disk for SATA performance testing, but it is the same make and model that I used for testing the Raspberry Pi USB disk throughput test.

 

Prerequisites:

apt-get install dosfstools
apt-get install expect expect-dev tcl8.6 tk8.6



ext2, ext3, ext4, vfat file system write tests 


I split a 2 TB disk into four equal sized partitions.

root@bananapi ~ # fdisk -l /dev/sda

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5d3d4ef6

Device     Boot      Start        End   Sectors   Size Id Type
/dev/sda1             2048  976758783 976756736 465.8G 83 Linux
/dev/sda2        976758784 1953515519 976756736 465.8G 83 Linux
/dev/sda3       1953515520 2930272255 976756736 465.8G 83 Linux
/dev/sda4       2930272256 3907028991 976756736 465.8G  c W95 FAT32 (LBA)

root@bananapi ~ # mkfs.ext2 -L ext2 /dev/sda1
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: 35d529af-5e67-4f17-8c78-5af67a4f85f8
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

mkfs.ext2 -L ext2 /dev/sda1  0.65s user 31.41s system 12% cpu 4:18.17 total
root@bananapi ~ # mkfs.ext3 -L ext3 /dev/sda2
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: d0fe6f90-cc02-4d98-ba62-a704692edaf3
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

mkfs.ext3 -L ext2 /dev/sda2  0.81s user 33.67s system 13% cpu 4:20.11 total
root@bananapi ~ # mkfs.ext4 -L ext4 /dev/sda3
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: 02029d9e-70e3-4012-a217-fff6754fe0b8
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

root@bananapi ~ # mkfs.vfat -n VFAT /dev/sda4
mkfs.fat 3.0.26 (2014-03-07)
root@bananapi ~ # cd /media
root@bananapi /media # mkdir ext2 ext3 ext4 vfat
root@bananapi /media # cd
 






root@bananapi ~ # cat write-throughputtest.exp
#!/usr/bin/expect -f

set force_conservative 0  ;# set to 1 to force conservative mode even if
                          ;# script wasn't run conservatively originally
if {$force_conservative} {
        set send_slow {1 .1}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}


set timeout -1
spawn $env(SHELL)
match_max 100000
expect "root@bananapi"
send -- "script /root/output.txt\r"
expect "Script started, file is /root/output.txt\r"
send -- "mount /dev/sda1 /media/ext2\r"
expect "root@bananapi"
send -- "mount /dev/sda2 /media/ext3\r"
expect "root@bananapi"
send -- "mount /dev/sda3 /media/ext4\r"
expect "root@bananapi"
send -- "mount /dev/sda4 /media/vfat\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext2\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext3\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext4\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/vfat\r"
expect "root@bananapi"
send -- "exit\r"
expect "Script done, file is /root/output.txt\r"
send -- "exit\r"
expect eof
root@bananapi ~ #










root@bananapi ~ # cat write-throughputtest.sh
#!/bin/sh
DEST=$1

# 18 x 1GiB = 18GiB
# assuming maximum write SATA2 286MiB/sec this should take more than a minute
# assuming poor write speed of 5 MiB/sec this should take more than a hour
# either way one pass should happen within 12 hours
echo touch $DEST/testbegin-write-starttime
touch $DEST/testbegin-write-starttime
date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \
        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576

do
 COUNT=`expr 1073741824 / $BS`
echo touch $DEST/${BS}b-write-starttime
 touch $DEST/${BS}b-write-starttime
date
echo dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
 dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
date
echo touch $DEST/${BS}b-write-endtime
 touch $DEST/${BS}b-write-endtime
date
echo sync
 sync
date
# any delay caused by sync will show up on next starttime
done

echo touch $DEST/testover-write-endtime
touch $DEST/testover-write-endtime
date

root@bananapi ~ #











root@bananapi ~ # cat read-throughputtest.sh
#!/bin/sh

SRCE=$1


# 18 x 1GiB = 18GiB
# assuming maximum read SATA2 286MB/sec this whould take just over a minute
# assuming poor read speed of 5 MiB/sec this should take just over a hour
# This script assumes that write-throughputtest.sh was run
# previously to generate the data files.

date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \
        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576
do
 COUNT=`expr 1073741824 / $BS`
date

echo dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
 dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
date
echo sync
 sync
date
done


date
root@bananapi ~ #





I'm converting the results so that I can display them in MiB/sec instead of dd's default of MB/sec. Because I'm copying a Gigabyte of data with each block size all I need to do is divide 1024 by the number of seconds that it took to get the result in MiB/second.



root@bananapi ~ # grep bytes output.txt | grep copied | head -18
1073741824 bytes (1.1 GB) copied, 775.481 s, 1.4 MB/s
1073741824 bytes (1.1 GB) copied, 428.811 s, 2.5 MB/s
1073741824 bytes (1.1 GB) copied, 222.595 s, 4.8 MB/s
1073741824 bytes (1.1 GB) copied, 115.167 s, 9.3 MB/s
1073741824 bytes (1.1 GB) copied, 67.9903 s, 15.8 MB/s
1073741824 bytes (1.1 GB) copied, 43.2929 s, 24.8 MB/s
1073741824 bytes (1.1 GB) copied, 28.109 s, 38.2 MB/s
1073741824 bytes (1.1 GB) copied, 24.2247 s, 44.3 MB/s
1073741824 bytes (1.1 GB) copied, 23.847 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.8354 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.7234 s, 45.3 MB/s
1073741824 bytes (1.1 GB) copied, 23.8386 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.6681 s, 45.4 MB/s
1073741824 bytes (1.1 GB) copied, 24.1159 s, 44.5 MB/s
1073741824 bytes (1.1 GB) copied, 24.3767 s, 44.0 MB/s
1073741824 bytes (1.1 GB) copied, 24.477 s, 43.9 MB/s
1073741824 bytes (1.1 GB) copied, 24.8436 s, 43.2 MB/s
1073741824 bytes (1.1 GB) copied, 24.3786 s, 44.0 MB/s
root@bananapi ~ # grep bytes output.txt | grep copied |  awk '{printf "%3.1f\n", 1024/$6}' | head -18
1.3
2.4
4.6
8.9
15.1
23.7
36.4
42.3
42.9
43.0
43.2
43.0
43.3
42.5
42.0
41.8
41.2
42.0
root@bananapi ~ #


 Results

SATA disk performance check on Banana Pi SATA port.


Banana Pi SATA disk write results (spinning rust)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
8       1.3 MiB/s  0.6 MiB/s  0.6 MiB/s  1.1 MiB/s
16      2.4 MiB/s  1.1 MiB/s  1.1 MiB/s  2.1 MiB/s
32      4.6 MiB/s  2.1 MiB/s  2.1 MiB/s  3.9 MiB/s
64      8.9 MiB/s  4.0 MiB/s  4.1 MiB/s  7.3 MiB/s
128    15.1 MiB/s  7.6 MiB/s  7.9 MiB/s 11.9 MiB/s
256    23.7 MiB/s 13.0 MiB/s 12.5 MiB/s 16.7 MiB/s
512    36.4 MiB/s 21.3 MiB/s 23.2 MiB/s 23.0 MiB/s
1k     42.3 MiB/s 30.9 MiB/s 36.0 MiB/s 26.4 MiB/s
2k     42.9 MiB/s 36.2 MiB/s 43.8 MiB/s 28.7 MiB/s
4k     43.0 MiB/s 40.3 MiB/s 44.5 MiB/s 29.7 MiB/s
8k     43.2 MiB/s 41.0 MiB/s 44.2 MiB/s 30.6 MiB/s
16k    43.0 MiB/s 40.6 MiB/s 44.0 MiB/s 31.0 MiB/s
32k    43.3 MiB/s
37.5 MiB/s 44.0 MiB/s 30.2 MiB/s
64k    42.5 MiB/s 39.9 MiB/s 43.4 MiB/s 30.4 MiB/s
128k   42.0 MiB/s 39.9 MiB/s 42.3 MiB/s 30.1 MiB/s
256k   41.8 MiB/s 39.1 MiB/s 43.3 MiB/s 29.8 MiB/s
512k   41.2 MiB/s 38.9 MiB/s 43.0 MiB/s 30.6 MiB/s

1M     42.0
MiB/s 39.6 MiB/s 43.5 MiB/s 30.0 MiB/s


Banana Pi SATA disk read results (spinning rust)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8        2.1MiB/s   2.1MiB/s   2.0MiB/s   2.0MiB/s
16       4.0MiB/s   4.1MiB/s   4.1MiB/s   4.0MiB/s
32       8.7MiB/s   8.6MiB/s  
8.5MiB/s   8.6MiB/s
64     
17.0MiB/s  16.9MiB/s  17.0MiB/s  16.9MiB/s
128     31.3MiB/s  31.2MiB/s 
31.5MiB/s  30.5MiB/s
256     54.8MiB/s  54.2MiB/s 
55.1MiB/s  52.4MiB/s
512     84.6MiB/s 100.4MiB/s 
83.9MiB/s  72.8MiB/s
1k     108.7MiB/s
100.4MiB/s  86.5MiB/s  74.2MiB/s
2k     107.7MiB/s  99.6
MiB/s  87.2MiB/s  73.8MiB/s
4k     109.7MiB/s 100.4
MiB/s  86.3MiB/s  72.6MiB/s
8k     109.7MiB/s 100.8
MiB/s  87.7MiB/s  73.1MiB/s
16k    109.8MiB/s
100.4MiB/s  86.6MiB/s  74.1MiB/s
32k    108.8MiB/s  98.0
MiB/s  87.6MiB/s  73.5MiB/s
64k    109.2MiB/s 100.4
MiB/s  86.0MiB/s  72.7MiB/s
128k   109.3MiB/s
100.7MiB/s  85.7MiB/s  73.2MiB/s
256k   108.7MiB/s
100.5MiB/s  86.8MiB/s  74.1MiB/s
512k   108.9MiB/s 
99.6MiB/s  88.1MiB/s  73.3MiB/s
1M     109.1MiB/s  99.2MiB/s 
86.7MiB/s  72.9MiB/s




I decided to run the tests again with an old 128GB SSD (write performance will be OKish because it is used, but read performance should be better than spinning rust). But to avoid killing it (small writes cause SSD's to fail prematurely) I started the write testing at 4K block size.The read test block size does not matter at all, SSD's always fail due to running out of writes (3000-5000 per block) long before any wear due to reads can happen. The reason I ran the tests again with a SSD was because I felt that the limiting factor was the Harddisk's poor read/write performance and not any limit of the Banana Pi's SATA 2.0 port.











Banana Pi SATA disk write results (SSD)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
4k     44.9 MiB/s 40.0 MiB/s 42.5 MiB/s 29.0 MiB/s
8k     45.3 MiB/s 41.0 MiB/s 42.5 MiB/s 29.8 MiB/s
16k    44.2 MiB/s 41.0 MiB/s 42.7 MiB/s 29.5 MiB/s
32k    43.9 MiB/s
41.7 MiB/s 42.4 MiB/s 29.3 MiB/s
64k    43.6 MiB/s 40.4 MiB/s 41.9 MiB/s 29.0 MiB/s
128k   42.5 MiB/s 39.5 MiB/s 42.1 MiB/s 28.3 MiB/s
256k   42.6 MiB/s 39.9 MiB/s 41.7 MiB/s 28.9 MiB/s
512k   43.8 MiB/s 39.7 MiB/s 
43.0 MiB/s 30.9 MiB/s
1M     43.7
MiB/s 40.3 MiB/s 41.7 MiB/s 32.0 MiB/s

Banana Pi SATA disk read results (SSD)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8        2.0MiB/s   2.0MiB/s   2.1MiB/s   2.1MiB/s
16       4.2MiB/s   4.2MiB/s   4.2MiB/s   4.2MiB/s
32       9.0MiB/s   8.9MiB/s  
9.1MiB/s   8.9MiB/s
64     
17.2MiB/s  17.1MiB/s  17.0MiB/s  17.0MiB/s
128     31.4MiB/s  31.6MiB/s 
31.5MiB/s  31.1MiB/s
256     53.7MiB/s  54.7MiB/s 
55.0MiB/s  55.0MiB/s
512     83.6MiB/s  85.8MiB/s 
86.6MiB/s  85.8MiB/s
1k     115.6MiB/s
126.0MiB/s 123.6MiB/s 121.9MiB/s
2k     139.4MiB/s 1
51.5MiB/s 154.0MiB/s 152.5MiB/s
4k     160.3MiB/s 181.1
MiB/s 175.1MiB/s 180.8MiB/s
8k     185.1MiB/s 1
86.0MiB/s 180.4MiB/s 183.9MiB/s
16k    182.8MiB/s
183.9MiB/s 176.4MiB/s 184.5MiB/s
32k    173.2MiB/s 161.3
MiB/s 168.8MiB/s 171.2MiB/s
64k    163.0MiB/s 151.4
MiB/s 158.6MiB/s 161.3MiB/s
128k   159.0MiB/s
147.2MiB/s 154.0MiB/s 156.5MiB/s
256k   156.0MiB/s
147.3MiB/s 152.0MiB/s 155.4MiB/s
512k   156.6MiB/s
145.2MiB/s 153.0MiB/s 156.3MiB/s
1M     157.9MiB/s 148.1MiB/s
154.8MiB/s 156.4MiB/s


Since the throughput is more than 150MB/sec, it does confirm that the SATA port in the Banana Pi is SATA 2.0. And I suspect that it could get closer to the SATA 2.0 limit of 300MB/sec if I used a brand new SSD. I have to admit that I am so much more impressed by a Banana Pi especially when compared to a Raspberry Pi. Especially for pushing large amounts of data about fast, it is brilliant hardware.