Why you should run a 64 bit OS on your Raspberry Pi4

Syntethic benchmarks

The first test which came to my mind was the old drystone bench which exists since the dawn of time

RAM

A 64 bit system means that RAM can be accessed in 8 byte read/writes per instruction.
I wrote a simple tool which allocates a big buffer, writes it and then reads it back. To be sure that the RAM was really allocated I used mlock() on the whole buffer. In this test the buffer is 2 GB; a 3 GB buffer worked in 64 bit mode but gave an out-of-memory error in 32 bit.

Audio encoding

I noticed that many Rpi users use the board as mediacenter, so I did an audio encoding with the two most used codecs.
I encoded “Echoes” by Pink Floyd because it’s a very long track to obtain some measurable values. To avoid I/O both the source and the destination file were on a ramfs:

Networking benchmarks

Another usage of the Raspberry boards is to act a simple VPN or firewall.
I don’t endorse the usage of such systems for this purpose, but many people have still slow <100 mbit links, so they can turn a blind eye on the bad Rpi performances.
The first question is: how much traffic can the Rpi4 handle?
We need to measure the pure networking power of the board, without the limitations of the physical interface first, so I run an iperf3 session between two containers.
Beware, containers use to comunicate via a veth pair, and veth is known to accelerate the traffic via a lot of fake offloads.
IP checksum offload is done by just skipping the checksum calculation, while TCP segmentation offload is done by never segmenting or reassembling the traffic: big chunk of 64k data are just passed in memory as is.
To overcome it, I disabled the offloadings with ethtool -K veth0 tx off rx off tso off gro off gso off

Firewalling

The fastest thing that a network appliance can do is to drop traffic, and the fastest way to drop traffic is via a TC drop rule. To avoid reaching the line rate, I used the minimum ethernet frame size, 64 byte.
This is a drop rate test.

VPN

Another common usage of the Rpi is as VPN server, OpenVPN to be precise.
My preferred VPN software is WireGuard, so I tested both, as both are very simple to setup:

Conclusions

Often I read statements like “It’s not worth it”, “you will gain a few milliseconds”, etc. just because the Rpi is not that powerful.
That’s not true! As any embedded guy may know, with slow hardwares, having a very optimized software is even more important than with powerful ones.
I already knew that a 64 bit OS would perform better on the Rpi4, what I didn’t knew was how much.
This is why I did this test series, I hope that you enjoy reading it!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matteo Croce

Matteo Croce

proud free software supporter, working @ Microsoft