Warning: This item maybe out of date WRT newer Linux kernels 5.0 and newer. A better solution maybe to use zram (and zswap) although that hasn't been evaluated by CSCF as of 2021-07-12
echo -e "\n# \n# We have lots of memory so make system much less aggressive in swapping memory out to disk. \nvm.swappiness=10 \n" | sudo -s tee -a /etc/sysctl.conf
References: