How Storj farming monitoring made me optimize my RPI3 setup?

In the last couple of weeks, I wrote 2 articles about the 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. 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

# reduce amount of memory dedicated to GPU

# reduce power consumption

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 (default config is 64MB) 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!

Laisser un commentaire

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