Saturday 29 March 2014

Raspberry Pi ethernet throughput test

Update (2015-02): There will be little to no change in throughput performance from the new Raspberry Pi Generation 2 Model B (900MHz quad-core ARM Cortex-A7 BCM2836) over the older Raspberry Pi Model B+ (700MHz ARM11 BCM2835), since the USB performance bottleneck is still the LAN9514 USB/Ethernet controller and will not be improved by additional CPU or RAM.
 
Update (2014-07): There is a new RPi model B+ with 4 USB ports (well 5 in fact when you include ethernet using a LAN9514 chip instead of 3 ports using the LAN9512 in the model B). Just to be clear the tests below were done on the model B. If and when I repeat the the tests with a model B+ I do not expect to see better performance.


 

Ethernet throughput test

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

Hardware Configuration:

Raspberry Pi model B - 512MB model, 128MB of RAM allocated to GPU, no overclocking
Inbuilt 10/100 NIC plugged.into router
Top USB port is empty
Bottom USB port is empty.






+------------+           +------+           +----------------+
|Raspberry pi|->100Mbps->|router|->200Mbps->|Remote webserver|
+------------+  Ethernet +------+ Internet  +----------------+
                            |
                          1Gbps Ethernet
                            |
                            v
                    +-------------+
                    |LAN webserver|
                    +-------------+



pi@raspberrypi ~ $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
pi@raspberrypi ~ $ sudo ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/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
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full

        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbag
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
pi@raspberrypi ~ $ 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    291504      0      0 0         68526      0      0      0 BMRU
lo        65536 0        16      0      0 0            16      0      0      0 LRU
pi@raspberrypi ~ $ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr **:**:**:**:**:**
          inet addr:*.*.*.*  Bcast:*.*.*.*  Mask:*.*.*.*
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:291554 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68565 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:434634216 (414.4 MiB)  TX bytes:5646424 (5.3 MiB)
 

pi@raspberrypi ~ $


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


Download a single 100MiB file to the Pi through 100Mbps Ethernet and send the downloaded data to /dev/null. This is to focus the test solely on the Ethernet throughput (and USB throughput) and nothing else.

pi@raspberrypi ~$ time wget http://qrng.physik.hu-berlin.de/file
--2014-03-29 05:53:19--  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'

100%[==========================================================================================================================================================>] 104,857,600 5.55M/s   in 23s

2014-03-29 05:53:42 (4.27 MB/s) - `/dev/null' saved [104857600/104857600]


real    0m23.647s
user    0m0.850s
sys     0m2.970s
pi@raspberrypi ~ $


LAN Test

Download a single 100MiB file to the Pi through 100Mbps Ethernet 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


pi@raspberrypi ~$  time wget http://*.*.*.*/ramdisk/speedtest-100MB.bin -O /dev/null
--2014-03-28 21:46:32--  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 11.2M/s   in 9.0s

2014-03-28 21:46:41 (11.2 MB/s) - `/dev/null' saved [104857600/104857600]


real    0m9.002s
user    0m0.700s
sys     0m2.300s
pi@raspberrypi ~ $


Results
Peak Internet transfer rate 5.55MiB/sec (46.6Mbps) - about 13 hops away
Average Internet throughput 4.27MiB/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 transfer rate 11.2 MiB/sec (94Mbps) - for 100Mbps this is basically maximum throughput.
Average LAN throughput 11.2 MiB/sec - for 100Mbps this is basically maximum throughput.

For every packet there is header information. Source/Destination MAC,  Source/Destination IP,  Source/Destination port, packet length, checksums to check for corruption, etc. (circa 3% of  MTU sized packet) this and packet ACK delays is where the missing 6% overhead has gone. You will never see 11.92MiB/sec throughput on a 100Mbps Ethernet card using TCP/IP.

I'm very pleased with the LAN Ethernet result for the Raspberry Pi.

2 comments:

  1. Hey, can you please tell me what is the maximum throughput of USB and Ethernet port you achieved on raspberry pi 3 Model B when all 4 ports of USB and ethernet are used simultaneously.

    ReplyDelete
    Replies
    1. I don't buy RPi hardware any more. My interest in small low power devices is for moving as much data about as fast as possible and this is one thing that the whole RPi line is dire at doing. All RPi hardware have a single real USB 2.0 port behind a hub which also includes a USB 10/100NIC. So the upper limit would be ~ 40MB/sec and you would loose about 5-20% of that for each active device. So with 5 active devices I would expect to see, in total, about at best 30MB/sec but I would hope it would be more than 0MB/sec throughput. RPi hardware : Support good, hardware - high quality, cheap - check, good for moving large amounts of data about fast - bottom of the list of hardware.

      Delete