Enable Swap on SSD Cloud-Based Virtual Hosts
An easy way to get more value from your cloud provider is to enable swap on your SSD-based virtual hosts.
“Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time. Due to this consideration, we do not recommend enabling swap on DigitalOcean or any other provider that utilizes SSD storage”
Assuming you are able to recover your instances quickly (using some sort of auto-deploy process), you don’t care about their hardware degradation.
You are paying for a virtualized service to avoid worry about hardware.
And you don’t want processes hard-killed by the operating system – in case you need more memory than you have purchased.
Here are some tutorials on how to enable swap on Ubuntu on Digital Ocean.
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04