Wednesday, 26 March 2014

Raspberry Pi WiFi 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 RPi model B+, I do not expect to see better performance.

 

 

 

WiFi throughput test


Hardware Configuration:

Raspberry Pi model B - 512MB model, 128MB of RAM allocated to GPU, no overclocking
Inbuilt 10/100 NIC unplugged.
Top USB port WiFi device plugged into RPi. (TL-WN725N 150Mbps 802.11n 8188eu)
Bottom USB port is empty.


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








+------------+           +------+           +----------------+
|Raspberry pi|->150Mbps->|router|->200Mbps->|Remote webserver|
+------------+  802.11n  +------+ 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
        |__ Port 2: Dev 4, If 0, Class=vend., Driver=rtl8188eu, 480M
pi@raspberrypi ~ $ sudo iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"**********"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.422 GHz  Access Point: **:**:**:**:**:**
          Bit Rate:150 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
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         0      0      0 0             0      0      0      0 BMU
lo        65536 0     76192      0      0 0         76192      0      0      0 LRU
wlan0      1500 0    221884      0    473 0         44770      0      0      0 BMRU
pi@raspberrypi ~ $ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr f8:1a:67:**:**:**
          inet addr:*.*.*.*  Bcast:*.*.*.*  Mask:*.*.*.*
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:221888 errors:0 dropped:473 overruns:0 frame:0
          TX packets:44775 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:468193693 (446.5 MiB)  TX bytes:383879182 (366.0 MiB)


It is Wireless and I'm sure that I have rebooted my router a few times, this would explain the 0.2% of received packets that were dropped. The number is static and not continually increasing so it is not something to be concerned about.

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


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

pi@raspberrypi ~ $ time wget http://qrng.physik.hu-berlin.de/files/speedtest-100MB.bin -O /dev/null
-2014-03-22 04:52:05--  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 6.05M/s   in 22s

2014-03-22 04:52:28 (4.57 MB/s) - `/dev/null' saved [104857600/104857600]


real    0m23.044s
user    0m0.920s
sys     0m10.970s
pi@raspberrypi ~ $

LAN Test

Download a single 100MiB file to the Pi through WiFi 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 wireless router with the data being read from a RAM disk to maximise read performance.
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 20:07:53--  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 10.4M/s   in 11s

2014-03-28 21:28:36 (9.51 MB/s) - `/dev/null' saved [104857600/104857600]


real    0m10.592s
user    0m0.430s
sys     0m4.800s


Results
Peak Internet transfer rate 6.05MiB/sec (50.8Mbps) - about 13 hops away
Average Internet throughput 4.57MiB/sec - about 13 hops away.

Peak LAN transfer rate 10.4 MiB/sec (87.2Mbps) - 802.11n Wifi to router  1Gbps cable to server
Average LAN throughput 9.51 MiB/sec (80Mbps) - 802.11n Wifi to router  1Gbps cable to server

 
[EDIT: I was not very happy with this low average throughput on150Mbps WiFi so I decided to repeat the test on all 13 channels (using 802.11n lower and upper control sidebands), to see the average throughput result could be greater than 80Mbps and closer maybe to 150Mbps]

Additional tests

There is a lot of WiFi traffic within range of my router. And my router does show "severe" interference for a lot of 802.11n 40MHz channels, and "Acceptable" for most of the channels showing greater than 9 MiB/sec throughput.

Average LAN throughput results, tests were repeated 8 hours apart.
Time      13:00        21:00        05:00
chan  1L - 9.45 MiB/s - 9.52 MiB/s - 7.53 MiB/s
chan  2L - 8.91 MiB/s - 9.28 MiB/s - 7.14 MiB/s
chan  3L - 9.89 MiB/s - 9.20 MiB/s - 7.03 MiB/s
chan  4L - 5.84 MiB/s - 5.28 MiB/s - 5.16 MiB/s
chan  5L - 6.04 MiB/s - 5.85 MiB/s - 5.00 MiB/s
chan  6L - 8.53 MiB/s - 7.08 MiB/s - 6.13 MiB/s
chan  7L - 6.09 MiB/s - 5.79 MiB/s - 5.42 MiB/s
chan  8L - 5.94 MiB/s - 5.70 MiB/s - 4.74 MiB/s
chan  9L - 8.51 MiB/s - 7.31 MiB/s - 8.54 MiB/s


chan  5U - 6.29 MiB/s - 5.97 MiB/s - 5.95 MiB/s
chan  6U - 9.29 MiB/s - 8.03 MiB/s - 6.57 MiB/s
chan  7U - 6.15 MiB/s - 5.83 MiB/s - 4.97 MiB/s
chan  8U - 6.12 MiB/s - 5.82 MiB/s - 4.80 MiB/s
chan  9U - 9.70 MiB/s - 9.26 MiB/s - 5.68 MiB/s

chan 10U - 6.20 MiB/s - 5.32 MiB/s - 6.02 MiB/s
chan 11U - 8.40 MiB/s - 8.31 MiB/s - 6.15 MiB/s

chan 12U - 5.92 MiB/s - 5.78 MiB/s - 6.10 MiB/s
chan 13U - 9.67 MiB/s - 8.30 MiB/s - 8.65 MiB/s



The best result: was 9.89 MiB/sec (83Mbps) which is nowhere near 150Mbps. Looks like this result is typical and not a throughput limitation of the RPi.

No comments:

Post a Comment