How Fast Does a Raspberry Pi Reboot?

I own two Raspberry Pis which are currently taped to my kitchen cabinets. They perform a range of tasks that require an always-on, but low-power, computer. The first one, named Raspberry Pion,1 seeds open-source torrents 24/7. It is a slightly older (and hence slower) Raspberry Pi 2 Model B. The second one, named Raspberry Kaon,2 runs a VPN that I connect to when using insecure wireless networks away from home. It is a newer Raspberry Pi 3 Model B.

Both computers run Ubuntu Mate 16.04 for the Raspberry Pi, and both suffer from a memory leak I have not been able to track down. My solution is to reboot the computers at 0100 every night using a cronjob. They report their status to Twitter when they come back online, which lets me know that they have successfully rebooted and how long it took. One of my friends noticed that Raspberry Pion seemed to take a few seconds longer than Raspberry Kaon, which prompted me to take a look.

You can find the notebook here (rendered on Github). Pion’s tweet data is here, and Kaon’s tweet data is here.

Reboot Times

The Raspberry Pis report the time they come back online to Twitter, as follows:

An example of the status Tweet sent by Raspberry Kaon

The clocks on the Raspberry Pis are kept synchronized with a central server using NTP. The network latency of sending the tweet is not an issue as the timestamps are generated locally before being sent to Twitter. However, the two machines differ in more than just their hardware: the Raspberry Pi 2 serves torrents meaning it has hundreds of network connections open which might slow down its shutdown process. So this is not a completely fair benchmark.

I pulled down all the reboot announcement tweets from my two Raspberry Pis and computed the time difference in seconds from 0100. I discarded any difference over five minutes, as these were primarily cases where the Raspberry Pi rebooted at some other time of the day. From these I created an animated histogram comparing the reboot times of the two computers over the 10 months they have been running. Each month is about one second of animation.

Here is a static image of the plot if you prefer.

The Raspberry Pi 2 and 3 reboot with median times of 32 and 29 seconds respectively. The peaks are quite sharp indicating that the time to reboot is pretty consistent. There is a peak of fast reboots for the Pi 2 at about 25 seconds, which seem to come in clumps, which I have no good explanation for. You can also see when I move apartments in late August; I had no internet for awhile and so the Raspberry Pis were not plugged in, leading to a half a second of no updates!

Animated Plots

A final note about animated plots: I am a huge fan of using animation to represent the time axis because I think it makes the display of information more intuitive. Using FuncAnimation from matplotlib was a bit tough (and I think my code is far from optimal), but once I got it working it was a lot faster than rendering the individual frames and creating the video afterwards. For tips on making the animation render even faster, see my post on using blitting in matplotlib.

In the future I hope to make more fun animations!


  1. From pion; physicists have notoriously terrible senses of humor. 

  2. After the kaon, of course. If I get another, I’ll have to name it something like J/ψ, and that just doesn’t have the same ring to it.