Swap is an area on your hard drive that can store data when your RAM is full. First we need to check to see if a swap area is configured:
If you get the headers back only, you have no swap space:
sudo swapon -s
Now lets create a 4 gig swap:
Verify that is has been created and is the correct size
You should see something like this:
sudo fallocate -l 4G /swapfile
ls -lh /swapfile
Now change the folder permissions:
Set up swap
You will should see the output below.
sudo chmod 600 /swapfile
sudo mkswap /swapfile
Now enable swap
Lets check to see if we have swap space
We should get the following output:
sudo swapon /swapfile
sudo swapon -s
To make the changes permanent you need to update the fstab file
sudo echo '/swapfile none swap sw 0 0' >> /etc/fstab
Swappiness can be configured between 0 and 100. The nearer to 0 the more data will be put into the RAM rather than the swap.
To view the current swappiness:
To change the swapiness to 10:
This only takes effect on reboot, so also run this command to effect this change immediately
sudo sysctl vm.swappiness=10
font
http://blog.chris-ritchie.com/2015/02/installing-wildfly-on-ubuntu-14.04-cloud-server.html
cat /proc/sys/vm/swappiness
sudo echo 'vm.swappiness=10' >> /etc/sysctl.conf