I’ve been struggling with my dd-wrt setup lately. So I started looking around for potential alternatives. One thought was to use a Raspberry Pi as router, but I was worried about its performance. So I did a few tests.

The first test was simply the network throughput between a client computer and the Pi itself (no routing, bridging or NATing, simply memory-to-memory throughput).

To be completely honest, there was one additional thing: the IP traffic was arriving on a VLAN-interface (eth0.100), so the ARM-processor has to de-encapsulate the 802.1q tag as well.

The results were not bad, but not super either:

$ iperf -c 10.0.100.1 -p 5000 -t 60 -i 5
------------------------------------------------------------
Client connecting to 10.0.100.1, TCP port 5000
TCP window size: 129 KByte (default)
------------------------------------------------------------
[ 5] local 10.0.100.2 port 56290 connected with 10.0.100.1 port 5000
[ ID] Interval Transfer Bandwidth
[ 5] 0.0- 5.0 sec 48.6 MBytes 81.6 Mbits/sec
[ 5] 5.0-10.0 sec 54.2 MBytes 91.0 Mbits/sec
[ 5] 10.0-15.0 sec 51.2 MBytes 86.0 Mbits/sec
[ 5] 15.0-20.0 sec 52.9 MBytes 88.7 Mbits/sec
[ 5] 20.0-25.0 sec 54.1 MBytes 90.8 Mbits/sec
[ 5] 25.0-30.0 sec 53.8 MBytes 90.2 Mbits/sec
[ 5] 30.0-35.0 sec 53.2 MBytes 89.3 Mbits/sec
[ 5] 35.0-40.0 sec 55.4 MBytes 92.9 Mbits/sec
[ 5] 40.0-45.0 sec 53.4 MBytes 89.5 Mbits/sec
[ 5] 45.0-50.0 sec 55.4 MBytes 92.9 Mbits/sec
[ 5] 50.0-55.0 sec 56.1 MBytes 94.2 Mbits/sec
[ 5] 0.0-60.0 sec 642 MBytes 89.7 Mbits/sec

During this test, the CPU maxed out: roughly 50% in system, and 50% in softirq. This means that adding additional processing (NAT, QoS, traffic shaping, firewall rules) will only decrease this number. But it also means that newer kernels can, potentially, be more efficient at this task.

When trying a full-duplex flow, I get the following results:

$ iperf -c 10.0.100.1 -d -p 5000 -t 60 -i 5
------------------------------------------------------------
Server listening on TCP port 5000
TCP window size: 128 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 10.0.100.1, TCP port 5000
TCP window size: 129 KByte (default)
------------------------------------------------------------
[ 5] local 10.0.100.2 port 56341 connected with 10.0.100.1 port 5000
[ 6] local 10.0.100.2 port 5000 connected with 10.0.100.1 port 57327
[ ID] Interval Transfer Bandwidth
[ 5] 0.0- 5.0 sec 30.6 MBytes 51.4 Mbits/sec
[ 6] 0.0- 5.0 sec 16.1 MBytes 27.0 Mbits/sec
[ 5] 5.0-10.0 sec 30.2 MBytes 50.8 Mbits/sec
[ 6] 5.0-10.0 sec 16.1 MBytes 26.9 Mbits/sec
[ 5] 10.0-15.0 sec 30.9 MBytes 51.8 Mbits/sec
[ 6] 10.0-15.0 sec 15.8 MBytes 26.4 Mbits/sec
[ 5] 15.0-20.0 sec 31.0 MBytes 52.0 Mbits/sec
[ 6] 15.0-20.0 sec 15.8 MBytes 26.6 Mbits/sec
[ 5] 20.0-25.0 sec 30.6 MBytes 51.4 Mbits/sec
[ 6] 20.0-25.0 sec 15.9 MBytes 26.6 Mbits/sec
[ 5] 25.0-30.0 sec 31.1 MBytes 52.2 Mbits/sec
[ 6] 25.0-30.0 sec 15.8 MBytes 26.5 Mbits/sec
[ 5] 30.0-35.0 sec 31.1 MBytes 52.2 Mbits/sec
[ 6] 30.0-35.0 sec 15.8 MBytes 26.5 Mbits/sec
[ 5] 35.0-40.0 sec 31.4 MBytes 52.6 Mbits/sec
[ 6] 35.0-40.0 sec 15.6 MBytes 26.3 Mbits/sec
[ 5] 40.0-45.0 sec 30.0 MBytes 50.3 Mbits/sec
[ 6] 40.0-45.0 sec 16.3 MBytes 27.3 Mbits/sec
[ 5] 45.0-50.0 sec 31.5 MBytes 52.8 Mbits/sec
[ 6] 45.0-50.0 sec 15.6 MBytes 26.2 Mbits/sec
[ 5] 50.0-55.0 sec 31.5 MBytes 52.8 Mbits/sec
[ 6] 50.0-55.0 sec 15.6 MBytes 26.2 Mbits/sec
[ 5] 0.0-60.0 sec 371 MBytes 51.9 Mbits/sec
[ 6] 55.0-60.0 sec 15.6 MBytes 26.1 Mbits/sec
[ 6] 0.0-60.0 sec 190 MBytes 26.6 Mbits/sec

As you can see, these results are not really super…

The fine print:

  • Raspberry Pi model B
  • Class 10 (50MB/s) 32GB SD card
  • Kernel 3.10.25, as shipped with Raspbian
  • The OS was Raspbian Server Edition 2.5, so there were almost no additional processes running.
  • The only things attached were power and ethernet, no other device was connected to the USB bus.
  • Raspberry pi was connected to an Juniper EX2200-48T-4G (which should be more than capable enough to handle 100Mbit/s full duplex)
  • The Raspberry pi ran the iperf server; the iperf client was run on an Apple MacBook Air with the thunderbolt Gigabit ethernet adapter

2 Comments

  1. uwe says:

    So the final setup will be built with an additional USB ethernet adapter(and maybe a wifi adapter+hostapd)?Probably the adapter also has impact on the performance. May be worth it to test different models. thought about this myself but currently I’m pretty satisfied with the new Hardware I bought and openwrt

  2. Niobos says:

    Since the bottleneck seems to be the bandwidth from the NIC to the CPU (i.e. the USB bus), adding another adapter will probably not solve the problem. It is true that some models of USB-NIC’s might have better drivers, but I currently have no intention to buy and try these.

    I’ll probably go down the same route you did: get an OpenWRT-supported router and go from there.