Showing posts with label TL-WN725N. Show all posts
Showing posts with label TL-WN725N. Show all posts

Monday, 7 April 2014

Part two: 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 model B+ I do not expect to see better performance.



When I looked at the performance of 802.11n I only looked at the highest possible throughput setting that I could setup (In my case a 150Mbps on a TP-LINK WN725N which is software compatible with 8188eu USB Wifi dongle). But not everyone has a 802.11n WiFi adapter, so I decided to run the tests again but this time to force the Wifi to lower performance modes, to see the different throughput rates. This is wireless so my results will differ than anyone else's but they should give a idea of what kind of real world (non-marketing) throughput to expect.

But one thing to remember is that these are maximum throughput rates, since all WiFi data received is being thrown away. If the data was written to an SD card then four other things would need to be factored in: The make and model of the SD card, the read performance of the card; the write performance of the card and most importantly the age of the card. The more writes you do to a SD card the slower it's overall performance becomes, anyhow the initial performance of most SD cards can be found here

The setup is exactly the same as last time. A midrange Linux PC running a nginx webserver serving a 100MiB file from a 256MiB RAM disk. The data flows through a 1Gigabit/sec full duplex NIC to a home cable modem from there it is sent via WiFi to my USB Raspberry Pi WiFi NIC and finally sent to /dev/null to eliminate any SD/harddisk access times. I set the speed on the broadband router to three different settings:
54Mbit/sec = disable 802.11n.

72Mbit/sec = 802.11n 20MHz bandwidth,
150Mbit/sec = 802.11n 40MHz bandwidth,

And after setting the channel and speed, I confirmed both had actually changed correctly on the RPi with the iwconfig command. I also download the same 100MiB file 3 times in a row and these are the numbers MiB/second numbers on each row below.

e.g.
wget http://192.168.1.100/ramdisk/speedtest-100MB.bin -O /dev/null ; wget http://192.168.1.100/ramdisk/speedtest-100MB.bin -O /dev/null ; wget http://192.168.1.100/ramdisk/speedtest-100MB.bin -O /dev/null


pi@raspberrypi ~ $ sudo iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"**********"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.472 GHz  Access Point: 80:C6:AB:**:**:**
          Bit Rate: 54 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 ~ $



802.11a
802.11 band: 2.4GHz
Bit Rate: 54Mb/s  (6.44MiB/sec)
Bandwidth 20MHz 
Download rate: 1.51 MiB/sec <-> 3.37 MiB/sec
Download rate: 12.67 Mbit/sec <->  28.27 Mbit/sec
channel  1  Frequency:2.412 GHz  2.10 MB/s 2.14 MB/s 2.12 MB/s
channel  2  Frequency:2.417 GHz  1.83 MB/s 1.88 MB/s 1.87 MB/s
channel  3  Frequency:2.422 GHz  1.51 MB/s 1.57 MB/s 1.55 MB/s
channel  4  Frequency:2.427 GHz  1.61 MB/s 1.64 MB/s 1.65 MB/s
channel  5  Frequency:2.432 GHz  2.30 MB/s 2.29 MB/s 2.28 MB/s
channel  6  Frequency:2.437 GHz  2.48 MB/s 2.45 MB/s 2.44 MB/s
channel  7  Frequency:2.442 GHz  2.92 MB/s 2.91 MB/s 2.93 MB/s
channel  8  Frequency:2.447 GHz  2.96 MB/s 2.98 MB/s 2.97 MB/s
channel  9  Frequency:2.452 GHz  2.72 MB/s 2.74 MB/s 2.69 MB/s
channel 10  Frequency:2.457 GHz  3.00 MB/s 3.06 MB/s 3.05 MB/s
channel 11  Frequency:2.462 GHz  2.98 MB/s 3.01 MB/s 3.05 MB/s
channel 12  Frequency:2.467 GHz  3.22 MB/s 3.21 MB/s 3.23 MB/s
channel 13  Frequency:2.472 GHz  3.36 MB/s 3.37 MB/s 3.34 MB/s



802.11n
802.11 band: 2.4GHz
Bit Rate: 72  Mb/s (8.58MiB/sec)
Bandwidth 20MHz
Download rate: 3.77 MiB/sec <-> 6.15 MiB/sec
Download rate: 31.63 Mbit/sec <->  51.59 Mbit/sec

channel  1  Frequency:2.412 GHz  4.47 MiB/s 4.68 MiB/s 4.74 MiB/s
channel  2  Frequency:2.417 GHz  4.28 MiB/s 4.32 MiB/s 4.10 MiB/s
channel  3  Frequency:2.422 GHz  3.82 MiB/s 3.82 MiB/s 3.77 MiB/s
channel  4  Frequency:2.427 GHz  4.08 MiB/s 4.06 MiB/s 4.22 MiB/s
channel  5  Frequency:2.432 GHz  5.15 MiB/s 4.84 MiB/s 4.97 MiB/s
channel  6  Frequency:2.437 GHz  5.27 MiB/s 5.19 MiB/s 5.31 MiB/s
channel  7  Frequency:2.442 GHz  5.47 MiB/s 5.61 MiB/s 5.76 MiB/s
channel  8  Frequency:2.447 GHz  5.92 MiB/s 6.15 MiB/s 6.04 MiB/s
channel  9  Frequency:2.452 GHz  5.45 MiB/s 5.44 MiB/s 5.41 MiB/s
channel 10  Frequency:2.457 GHz  6.04 MiB/s 6.12 MiB/s 6.02 MiB/s
channel 11  Frequency:2.462 GHz  5.72 MiB/s 5.63 MiB/s 5.67 MiB/s
channel 12  Frequency:2.467 GHz  5.78 MiB/s 5.85 MiB/s 5.74 MiB/s
channel 13  Frequency:2.472 GHz  6.07 MiB/s 6.11 MiB/s 6.08 MiB/s



802.11n
802.11 band: 2.4GHz
Bit Rate: 150  Mb/s (17.88MiB/sec)
Bandwidth 40MHz
Download rate: 4.03 MiB/sec <-> 9.67 MiB/sec
Download rate: 33.81 Mbit/sec <-> 81.11 Mbit/sec

channel  1L Frequency:2.412 GHz  8.92 MiB/s 9.24 MiB/s 7.66 MiB/s
channel  2L Frequency:2.417 GHz  8.46 MiB/s 8.99 MiB/s 5.70 MiB/s
channel  3L Frequency:2.422 GHz  9.16 MiB/s 8.41 MiB/s 9.32 MiB/s
channel  4L Frequency:2.427 GHz  5.19 MiB/s 8.62 MiB/s 8.31 MiB/s
channel  5L Frequency:2.432 GHz  4.23 MiB/s 4.37 MiB/s 4.74 MiB/s
channel  6L Frequency:2.437 GHz  4.03 MiB/s 7.91 MiB/s 9.38 MiB/s
channel  7L Frequency:2.442 GHz  8.22 MiB/s 8.01 MiB/s 8.03 MiB/s
channel  8L Frequency:2.447 GHz  9.58 MiB/s 8.12 MiB/s 9.67 MiB/s
channel  9L Frequency:2.452 GHz  5.47 MiB/s 5.26 MiB/s 5.35 MiB/s

channel  5U Frequency:2.432 GHz  7.91 MiB/s 7.92 MiB/s 9.48 MiB/s
channel  6U Frequency:2.437 GHz  7.58 MiB/s 9.05 MiB/s 7.58 MiB/s
channel  7U Frequency:2.442 GHz  7.10 MiB/s 9.48 MiB/s 9.41 MiB/s
channel  8U Frequency:2.447 GHz  9.52 MiB/s 9.38 MiB/s 9.15 MiB/s
channel  9U Frequency:2.452 GHz  9.42 MiB/s 9.22 MiB/s 9.07 MiB/s
channel 10U Frequency:2.457 GHz  8.77 MiB/s 9.46 MiB/s 8.10 MiB/s
channel 11U Frequency:2.462 GHz  8.65 MiB/s 9.30 MiB/s 9.41 MiB/s
channel 12U Frequency:2.467 GHz  8.64 MiB/s 9.01 MiB/s 9.34 MiB/s
channel 13U Frequency:2.472 GHz  9.02 MiB/s 9.55 MiB/s 8.45 MiB/s

My Wifi router supports four 20MHz channels in the 5GHz band (36, 40, 44, 48 [5.180GHz 5.200GHz 5.220GHz 5.240GHz]) but unfortunately my TP-LINK nano USB WN725N only supports the 2.4GHz band (2.4 ~ 2.4835GHz), so I can't test the throughputs in the 5GHz band. Which is a pity, because higher RF frequency means lower penetration depth into objects, so I would expect less interference at higher frequencies.

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.