Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You’re missing a ‘p’ in this line:
sudo sysctl vm.swapiness=10
should be:
sudo sysctl vm.swappiness=10
I also noticed your fstab has ‘defaults’ under options, it should be ‘sw’ instead. It is the default debian/ubuntu option for swap. ‘defaults’ is a great option for your userspace filesystem, but not ideal for swap.
/swapfile none swap sw 0 0
Hi Brandon:
You’re absolutely right on both points. Those were oversights on my part. I’ve updated the article to reflect your suggestions.
@chris: A general rule of thumb that people use is to have twice your memory in swap. So if you have 1 GB of RAM, you want 2 GB of swap. Though that was from back in the day when people didn’t have nearly as much memory as they usually do now. So 2 GB of swap is probably more than enough. If disk space is a concern, you can easily get away with 1 GB.
Nice article Justin. Is it absolutely necessary to have some swap (at least to begin with) when upgrading memory? If I have applications that mandate not to use swap. I set the swapiness to 0 on CentOS.
You’ve still got an error in the command:
sudo sysctl vm.swapiness=10
Should have another ‘p’:
sudo sysctl vm.swappiness=10
Helpful article. Thanks.
Ansible Automated version of this tutorial available @ http://greenycloud.com/adding-swap-to-digitalocean-droplets-or-any-vps-server-real-easy-way/
Swap memory should appear on Virtualmin System information page as Virtual memory ?