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]



4 comments:

  1. "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."

    If you are traversing the internet this MTU setting will only cause fragmentation due to router hops between yourself and the server set for 1500. If anything the fragmentation will probably make your throughput less.

    Also, I would suggest using iperf on the Pi and your webserver. It is very simple to install with apt assuming you are running something like Bananian on your BananaPi.

    ReplyDelete
    Replies
    1. Yes if I was traversing the Internet an MTU of 9000 would be very bad. But I was trying to push the hardware to see how much throughput it could achieve. Put everything that is under my control in the best possible state that it can be in to achieve the maximum throughput, so that the bottleneck to performance would hopefully be the hardware that I was testing. I don't know many real life webservers that serve their content from RAM drives, so it is artificial in many ways, to try and isolate one piece of hardware and see the best that you could ever hope for in performance.

      Good suggestion about the ipref, I'll give it a try at some stage when I get a chance. As for Bananian on my Banana Pi, I changed my apt-sources so it is running jessie instead of wheezy, but it did start out originally as Bananian. Switching to jessie (my BPi is not on the Internet, so slower security patches does not worry me at all) was the fastest way for me to install a version of gnuradio companion that supports the HackRF One SDR transceiver and Airspy SDR receiver.

      Delete
  2. Your MAC address is 80:3f:5d:08:69:ad ;)

    ReplyDelete
    Replies
    1. Very smart and well spotted (I hate IPv6), but if you search for the first 6 digits of that MAC address (80-3F-5D) at http://standards.ieee.org/develop/regauth/oui/public.html you may notice that it is not the MAC address of the Banana Pi, it is actually the MAC address of the "USB 2.0 'Gigabit' Ethernet Adapter", which I have now just smashed with a sledge hammer. The first 6 hex digits of my Banana Pi are "02-95-0B" which are not registered, it costs US $2,575 to register, which may be why Lemaker have not.

      Delete