SKALE Supernode Swap Limit Fix
Introduction
Section titled “Introduction”This guide provides instructions for SKALE validators to fix swap limit issues on their supernodes. We need to enable swap limiting capability so sChain containers can use swap properly.
Background
Section titled “Background”Swap memory is limited by default if memory for the container is limited. For each sChain container, 2.6GB of RAM is allocated on the machine, which means an additional 2.6GB will be allocated for swap. For more details, refer to the Docker documentation on resource constraints.
Checking Current Setup (Optional)
Section titled “Checking Current Setup (Optional)”You can check the current memory allocation for your sChain containers (if your supernode has sChains) using the following command:
docker inspect skale_schain_[SCHAIN-NAME] | grep MemoryA correct setup should look similar to this:
"Memory": 2678032302,"MemoryReservation": 0,"MemorySwap": 5356064604,"MemorySwappiness": null,MemorySwap should be x2 of Memory value.
Identifying the Issue
Section titled “Identifying the Issue”The issue occurs when the swap limit capability is disabled in the kernel. To check if this is the case, run:
docker infoIf you see the following line at the end of the output, it means the swap limiting capability is disabled:
WARNING: No swap limit supportFixing the Swap Limit Issue
Section titled “Fixing the Swap Limit Issue”Follow these steps to enable swap limiting capability:
-
Log into the supernode as a user that you used to setup the supernode (user should have sudo privileges).
-
Make a backup of your supernode and move backup archive to another machine:
Terminal window skale node backup [BACKUP_FOLDER_PATH] [ENV_FILE]Check out node-cli backup docs for more details.
-
Turn off your SKALE Supernode:
Terminal window skale node turn-offWait for the supernode to turn off gracefully.
-
Edit the
/etc/default/grubfile. Add or edit theGRUB_CMDLINE_LINUXline to include the following key-value pairs:GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" -
Update GRUB:
Terminal window sudo update-grub -
Reboot the machine:
Terminal window sudo reboot -
After the machine has rebooted, turn your SKALE Supernode back on:
Terminal window skale node turn-on [ENV_FILEPATH]Replace
[ENV_FILEPATH]with the path to your environment file (the same you used for supernode updates).For more details on this process, you can refer to this Unix Stack Exchange thread.
-
After the Supernode is turned on, check if the swap limit is enabled:
Terminal window docker infoNo warning should be displayed.