Raspberry Pi (B+): How to fix random daemon crashes and / or improve performance.

Since the network has been in very good shape (rock solid actually!!) i didn’t mind the occasional out of memory and subsequent crash of the daemon. It doesn’t matter if you run the full QT wallet or the daemon alone; RDD is pretty hard on the Pi. It uses almost all of the RAM and then some swap (default settings), not to mention almost two thirds of the CPU power with the chip running at 900Mhz.

img

As you can see the Pi is struggling as a staking full node, to the point that it may (or WILL) eventually crash due to lack of memory. And if you’re not around whenever that happens and some hours pass by… you can expect spending half an hour catching up.

Please note that the above screenshot shows 494572 KiB system memory but the default Raspbian install only lets you use 445804 KiB. The rest is reserved for the GPU. Also, this is a clean reboot so the swap file is almost empty, but it does fill up over time and the default 100 MiB will not cut it (for me, at least).

Anyway, to prevent the daemon (or QT wallet) from crashing randomly you’ll have to sacrifice GPU performance. The least it accepts is 16 MiB so you need to do the following:

sudo nano /boot/config.txt

Add (or modify):

gpu_mem=16

This is enough to render the desktop (even 1080p32) but barely anything else. Not that the Pi B+ can really handle other stuff when running the daemon, sadly.

Next thing you’ll want to do is to increase swap size(1). I have gone for 512 MiB but 256 should be good. The default is 100. To modify it, simply type:

sudo nano /etc/dphys-swapfile 

You’ll se a line (CONF_SWAPSIZE=100); just change the value to 256 or thereabouts (it’s just a guesstimation!). Now the only thing left to do is to apply the changes (or reboot):

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

(1): The SD card will wear out (i.e. start to fail and corrupt data) the more you use it, so it is generally a good idea to use other media as swap to preserve the SD. A mechanical drive would be ideal but any cheap and disposable usb dongle will do. Just edit dphys-swapfile like before but adding the following line (with the correct path):

CONF_SWAPFILE=/media/btsync/swapfile

And that’s pretty much all. This will not get your “ReddPi” enterprise server reliability (not by a long shot) but it will save you some time and a bit of light swearing.

as a comparison, my staking QT version uses about
444 MB RAM,
with about 2-5% cpu load

I am not on a Pi
Didi nice howto you have there. thx

1 Like

erkan

Thanks. It’s also good to know other system’s usage for comparison. Which OS are you running?

it’s (also) a linux