Part 3a - Adding swap and Benchmark

  • It is recommended to add swap to ensure (1) stable running of the zend daemon (and Side Chain Applications for Super Nodes) (2) challenge times that meet the criteria (Super Node:100 seconds)
  • It is generally good practice to allocate as much swap as your configuration has physical RAM


DescriptionCommand
1

Check your current memory and swap space configuration and availability

NOTE: Under the "total" column, you will see the total system memory allocation needed to configure the swap for step 2

free -h

Get a list of swapfile names and paths for your system

sudo swapon -s

Turn off and remove the swap file if one already exists (change /swapfile as necessary to the path and name of your swapfile)

sudo swapoff /swapfile
sudo rm /swapfile
2

Allocate the swapfile, changing the command as necessary

NOTE: A Super Node with 8GB RAM, may add a 8GB swap file (change 2G on the right to 8G)

Don't enter this entry without first changing the value as instructed in the description column

sudo fallocate -l 2G /swapfile
3Set permissions on the swapfile
sudo chmod 600 /swapfile
4Format the file as swap space
sudo mkswap /swapfile
5Activate swap
sudo swapon /swapfile
6

Validate swap is activated using this command, the output should return a row for 'Swap:' as shown in the example output; with the value in the 'total column matching the allocated amount of swap from step 1

free -h

This is an example of a system with 2GB of RAM, 2GB of swap was set in step 2

Example Output

zenops@node01:~$ free -h
............................total............used.................free.......shared....buff.cache.......available
Mem:.................1.9G............1.3G.................66M...........12M.............576M.............489M
Swap:.................2.0G...........0.0M.................2.0G

7

Edit the /etc/sysctl.conf file to specify the 'swappiness' behaviour of your node

Edit the /etc/fstab file, specifying that swap should be mounted at boot

echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
8Activate the updated configuration (without rebooting)
sudo sysctl -p

Part 3a of 11 - Adding swap and Benchmark



© 2020 Horizen. All rights reserved.