Raspberry Pi - Networking Performance

1. December 2012 11:03



I put together a simple program call tcp-bandwidth which measure performance over a data stream sent from the client to the server. So to do this test you will require two linux machines. eg the rasberry pi and another machine to act as a client or server.


Running the tool.


Download tcp-bandwidth-2012-12-01.c


Compile it using


gcc -Wall -O2 tcp-bandwidth.c -o tcp-bandwidth -lrt


You will need to repeat this on both the pi and the main machine.



On the pi run


./tcp-bandwidth 5000


On the main machine run


./tcp-bandwidth <pi ip address> 5000


Results - Machine -> PI


Speed: 6.529282 MBytes/Sec

Speed: 6.404114 MBytes/Sec

Speed: 6.443649 MBytes/Sec

Speed: 6.745232 MBytes/Sec

Speed: 6.453972 MBytes/Sec



On the main machine run


./tcp-bandwith 5000


On the pi run


./tcp-bandwidth <ip address of machine> 5000


Results - PI -> Machine


Speed: 6.398438 MBytes/Sec

Speed: 6.335938 MBytes/Sec

Speed: 6.109375 MBytes/Sec

Speed: 6.250000 MBytes/Sec

Speed: 6.320312 MBytes/Sec

Speed: 6.351562 MBytes/Sec



From this we know that the pi is capable of sending data at speeds > 6MBytes / sec or around 50MBit/sec. On an un-tuned tcp stack with the arm running at 700Mhz. Using around 30% cpu time (messured using top)


I would be interested if other people ran the tests and posted some of the results. If you do please include the client -> server speed, server -> client speed, cpu speed, whether its a 256Mb / 512Mb pi and if you have done any tuning / modifications of the Linux networking stack.


If people send in results i will put together a list of known configurations and performance results. Unfortunatly I have limited networking hardware to test with and is under load from other things in the enviroment which are probably knocking my results slightly.

E-mail Kick it! DZone it! del.icio.us Permalink

Comments (6) -

12/11/2012 4:26:30 PM #

Hi, here are the results from my test:
Raspberry Pi, 256 RAM, running Gentoo Linux with no networking stack tweaks made, tests performed with iperf version 2.0.5

Pi > Machine: 93.9 Mbps, single tcp connection, cpu ~65%
Machine > Pi: 93.0 Mpbs, single tcp connection, cpu ~70%

For some reason I was unable to do a bidirectional test simultaneously, I guess I ran into a bug.

daniel Bulgaria |

12/11/2012 4:45:40 PM #

simultaneously test:
Pi > Machine: 87.5Mbps
Machine > Pi: 90.9Mbps
cpu: 100%

I forgot to mention the overclocking settings:

daniel Bulgaria |

2/3/2013 5:59:03 PM #


trying to compile on the rasperry pi under raspbian gives me:
root@raspberrypi:~# gcc -Wall -O2 tcp-bandwidth-2012-12-01.c -o tcp-bandwidth -Lrt
/tmp/ccRwJVox.o: In function `Server':
tcp-bandwidth-2012-12-01.cFrown.text+0x170): undefined reference to `clock_gettime'
tcp-bandwidth-2012-12-01.cFrown.text+0x1a8): undefined reference to `clock_gettime'
/tmp/ccRwJVox.o: In function `Client':
tcp-bandwidth-2012-12-01.cFrown.text+0x31c): undefined reference to `clock_gettime'
tcp-bandwidth-2012-12-01.cFrown.text+0x33c): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status

Compiling under ARCH EMT64 did work.

che United States |

2/3/2013 6:13:32 PM #

ok solution was to use -lrt instead Lrt

from my pi under raspbian to my Server I get

Speed: 5.757812 MBytes/Sec
Speed: 10.820312 MBytes/Sec
Speed: 10.781250 MBytes/Sec
Speed: 10.765625 MBytes/Sec
Speed: 10.843750 MBytes/Sec
Speed: 10.921875 MBytes/Sec
Speed: 10.843750 MBytes/Sec

from my pi under Openelec to my Server I get

Speed: 3.359375 MBytes/Sec
Speed: 8.273438 MBytes/Sec
Speed: 8.265625 MBytes/Sec
Speed: 8.320312 MBytes/Sec
Speed: 8.234375 MBytes/Sec
Speed: 8.281250 MBytes/Sec

but using tvheadend on openelec is very slow and does a lot of caching, seems to be the htsp client.

Thanks for your nice program that does help me a lot ;)

che United States |

3/28/2013 10:06:26 PM #

For measuring transfer speeds there is already a well-established tool, iperf. It is available on all major distros (and on Raspbian).

prasinos Greece |

3/28/2013 10:53:47 PM #

For measuring maximum bandwidth performance iperf works great. For testing reality application performance it actually doesn't give you realistic figures.

james United Kingdom |