Why is swap usage stay zero always?

February 13, 2015 1.9k views

I created swap file using this tutorial (https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04) step by step. But swap usage is staying zero, always.

Here is monit status:

  memory usage                      1481664 kB [72.2%]
  swap usage                        0 kB [0.0%]

Which step should I follow? Any solution?

2 Answers

What is your vm.swappiness config?

Read Swappiness

  • I check this with following code:

    cat /proc/sys/vm/swappiness

    Gives me "10". Like I said before I followed tutorial step by step.

  • The less the swappiness the less the kernel will try to use swap. So, don't worry, if you want to test swap is working well try to make an agressive use of the server to increment the RAM use, so the swap will begin to be used too.

  • 2 days ago the site that I've tested swap get lots of user and I check the memory usage is more than 70%; the swap still zero. That's the point, right?

You shouldn't do anything. Everything is working as it should.

  • I dont think so. My droplet has been down because of the most ram usage. If swapping is working that shouldn't be happened.

  • Let's start with the basics then. Does the swap file appear when you type swapon -s ? If it is enabled there and has a size above 0, then it should be working, regardless of what else is happening on your droplet.

    Can you show us the output of free -h ?

    Of course you should resize your droplet if you're running out of memory and can't find an abnormal reason why.

Have another answer? Share your knowledge.