After Gettin’ hacked and rebuilding with a cheaper server I started encountering random slowness and problems. I always seemed to have random CPU spikes here and there but the console at digitalocean didn’t really give me much to work with.
Today I tried to install git so I can get some repos cloned down to demo and the process kept getting Killed. After some simple googling and basic cross referencing of the system I’m leasing I learned the stupidest thing in the world.
When you get yourself a VM though digitalocean it seems to be built for optimization. You’ve purchased enough disk space for what you need to store and enough RAM to run programs that you need to run. This implies that the disk space is 100% allocated to storage, nothing more. This means no Virtual Memory, so no swapping, and no problems.
So, I leared I have to create an actual swap file, enable it, and tweak it.
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | s1udo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /et2c/sysctl.conf
- https://unix.stackexchange.com/questions/98025/yum-update-shows-killed ↩︎
- https://stackoverflow.com/questions/49228066/npm-install-via-digital-ocean-gets-killed ↩︎
Once this was all done and set up to be mounted on reboot, with the mild sysctl optimizations I was able to do the next best thing. I’m also sure that swapping is not a good thing, but since I’m going the cheapo route on things I’ll take whatever performance hit I can so I can keep on truckin’.