Closed geerlingguy closed 9 years ago
I've posted a summary of my findings here: Getting Gigabit Networking on a Raspberry Pi
$ wget -O /tmp/test100.zip http://speedtest.wdc01.softlayer.com/downloads/test100.zip
2015-02-18 21:53:58 (8.54 MB/s) - `/tmp/test100.zip' saved [104874307/104874307]
$ rsync --progress pi@10.0.1.39:/tmp/test100.zip ~/Downloads/test100.zip
sent 42 bytes received 104887203 bytes 7769425.56 bytes/sec (7.77MB/sec)
$ rsync --progress ~/Downloads/test100.zip pi@10.0.1.39:/tmp/test100.zip
sent 104887199 bytes received 42 bytes 9120629.65 bytes/sec (9.12MB/sec)
$ iperf -c 10.0.1.38
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 113 MBytes 94.8 Mbits/sec
The onboard LAN integration has dramatically improved in the model 2! I was blown away by the difference, thinking I must've used a different SD card, or something, in the B+ testing. But I then ran all the tests twice more on the B+ and Pi 2, and found that they're correct. WOW.
My best guess is that the onboard LAN is no longer shared with the same bus/data pipeline as the microSD card, meaning data can be read/written to the microSD card independently of the LAN connection bandwidth.
$ wget -O /tmp/test100.zip http://speedtest.wdc01.softlayer.com/downloads/test100.zip
2015-02-18 21:43:08 (6.11 MB/s) - `/tmp/test100.zip' saved [104874307/104874307]
$ rsync --progress pi@10.0.1.38:/tmp/test100.zip ~/Downloads/test100.zip
sent 42 bytes received 104887203 bytes 8390979.60 bytes/sec (8.39MB/sec)
$ rsync --progress ~/Downloads/test100.zip pi@10.0.1.38:/tmp/test100.zip
sent 104887199 bytes received 42 bytes 6356802.48 bytes/sec (6.36MB/sec)
$ iperf -c 10.0.1.38
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 255 MBytes 214 Mbits/sec
Moved further discussion to the wiki: https://github.com/geerlingguy/raspberry-pi-dramble/wiki/Networking-Benchmarks
tl;dr Getting Gigabit Networking on a Raspberry Pi 2 and B+
I'd like to see what gives us the most bang for the buck, especially with regard to the load balancer and database server, which will need the lowest latency and highest throughput.
Theories/questions to test/verify/debunk
Notes
Switching interfaces (via SSH, since I'm doing everything headless) is a simple matter of:
$ sudo ifdown [eth0|wlan0]
(whichever one you are not connected through).$ sudo ifconfig -a
to list all interfaces and verify current status.$ ping 8.8.8.8
to test Internet connectivity, and if it's down:$ ip route show
to make sure there's adefault
route configured.$ sudo ip route add default via 10.0.1.1 dev [eth0|wlan0]
(whichever one you are connected through).$ ping 8.8.8.8
again to test Internet connectivity.Benchmarks
Internal microSD vs external USB 3.0 SSD
10/100 Ethernet (built-in)
Using
/tmp
(on the internal Kingston Class 10 microSD card):Using
/ssd
(on the external USB 3.0 SSD):By testing on an SSD and on the microSD card, it seems pretty obvious that disk I/O is not the bottleneck here, but rather the entire bus (so it seems).
And it also seems likely that, with a decent enough microSD card, there's no real performance to be gained (at least network/throughput-wise) from using an external HDD or SSD. I'm going to also test random read/write scenarios over in #7, so that might shed more light on database/codebase activity, and optimizations to be had there...
Note also that my local Internet connection is a bit past saturating the Pi's network interface (heck, it requires Gigabit or 802.11ac with a strong signal to saturate the connection on my Macs!). Here's the initial download, running on my MacBook Air with 802.11ac a couple feet from my AirPort Extreme:
Network throughput in common usage scenarios
802.11n USB WiFi
Using
/tmp
(on the internal Kingston Class 10 microSD card):WiFi is slightly slower; the signal was great, and I think it was hitting the full bus speed here as well (just like with the 10/100 example). But pretty stable and fast regardless. I have no hesitation using a reliable little WiFi adapter in lieu of wired Ethernet when it's more convenient.
10/100 Ethernet (built-in)
Using
/tmp
(on the internal Kingston Class 10 microSD card):10/100/1000 Gigabit Ethernet (external USB dongle)
Using
/tmp
(on the internal Kingston Class 10 microSD card):Raw Network Throughput using iperf
To do this test, install
iperf
on the Pi ($ sudo apt-get install -y iperf
), then:$ iperf -s
$ iperf -c 10.0.1.37
10/100 Ethernet
802.11n USB WiFi
10/100/1000 Gigabit Ethernet (external USB dongle)
Conclusion
It looks like, at least as far as a Raspberry Pi B+ and A+ are concerned, internal 10/100 Ethernet is more than adequate for most use cases, and other interfaces add throughput, but only for operations where other I/O is not a priority.
If network throughput is a priority, it is definitely worth investing in a 10/100/1000 Gigabit USB 3.0 adapter; even over the Raspberry Pi's USB 2.0 bus, you will see at least double the bandwidth, meaning uploads, downloads and streaming will get a LOT more bandwidth!