Why is swap usage stay zero always?

Posted February 13, 2015 15.4k views

I created swap file using this tutorial ( 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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

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.

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?