How Storj farming monitoring made me optimize my RPI3 setup?

In the last couple of weeks, I wrote 2 articles about the Storj.io project :

The first explains how to build a farming node with a Raspberry PI and the second how to monitor your node with Grafana.

What I learned from monitoring?

I’m now monitoring my nodes for a few days and noticed some interesting patterns that worth be mentioned.

First of all, the sharing amount increase step by step every day on the same period of time, between 10pm and noon in France which basically corresponds to working hours in USA. You can see the beautifull stairs drawn on the graph below:

Shared last 7 days

Without surprise, we can also notice this pattern in the Upload / Download rate graph below:

Downloaded vs Uploaded last 7 days

More surprisingly, I noticed that one of my nodes was restarting with the same pattern:

Restarts last 7 days

After a bit of inspection, it appears that memory usage hits the limit on download / upload peaks and make Storjshare daemon restart. Of course, the RPI3 memory amount is very limited (1GB of RAM) and the daemon quickly consume all of it when shards are uploaded to the node:

Used memory last 7 days

That is very uncool because, when Storjshare daemon crashes, you potentially loose the current contract and the corresponding data. Loose of contracts means less data, which obviously means, less money!

How to optimize your Raspberry PI for Storj farming?

I presume that you have a Raspberry PI 3, setup with Raspbian Jessie lite (without User Interface). If you don’t, you likely won’t have enough power to host an efficient Storj farming node. To setup Raspbian lite, please refer to the official doc here.

So what now? Is there a way to optimize the Raspberry PI to efficiently farm with Storj? The good news is, you can customize a few things in the RPI « BIOS ».

The closest thing to a traditional BIOS for the Raspberry PI can be found in /boot/config.txt. In that file, you can tweak a lot of parameters, all described here.

To optimize your Raspberry, insert the following lines in your config file:

# Settings to optimize Storj farming
force_turbo=1
boot_delay=1
disable_splash=1

# reduce amount of memory dedicated to GPU
gpu_mem=16

# reduce power consumption
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt

The most interesting parameter is gpu_mem=16. It reduces to a minimum the amount of RAM dedicated to your the RPI GPU which in turns, frees some usefull megabytes for your storjshare-daemon.

Removing Wifi and BT should reduce consumption a little and also deactivate associated services.

Do not forget to reboot your Raspberry PI to see the changes take effect.

Of course, do not install anything else on your Raspberry PI that consume RAM or CPU.

Finally, if you have setup a monitoring solution as I mentionned in one of my previous articles, please be aware that sending metrics with collectd too often is very inefficient and consume a lot of CPU/RAM. You should send metrics at most each 2 minutes in my opinion.

With this config, your farming node should be a lot more stable and efficient. At least, it’s what happened to mine!

Publié par Olivier Balais

Jeune ingénieur logiciel basé à Lyon (@overnetcity) passionné par les NTIC et le développement Web, je suis actuellement salarié chez Reputation VIP et effectue en parallèle des missions ponctuelles en temps que Freelance. Passionné depuis toujours par l'informatique et le développement, suite à une formation solide à l'INSA de Lyon, je me suis spécialisé dans la réalisation de bout en bout de projets web complexes.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *