Ubuntu – Should the swap size be zero or am I misunderstanding the output

14.04swaptomcat7

We are running an Amazon EC2 R3 instance so has 30G of memory available. We are running 5 Apache Tomcats (version 7). According to lsb_release -a the version of Ubuntu is: Ubuntu 14.04.2 LTS

Tomcats keep terminating on this machine from unknown conditions. This machine is more than adequate to run many Tomcats and after a single Tomcat termination, running free -h shows at least 10G available.

When I run the command cat/proc/swaps the following is displayed:

cat /proc/swaps
Filename                                Type            Size    Used    Priority

Does this mean that no swap partition is in place? Running the swapon command shows the same output:

swapon -s
Filename                                Type            Size    Used    Priority

Running the top command shows:

Swap:        0 total,        0 used,        0 free.

So do these results show that no swap is available for when processes need it or does it show no swap is currently being used?

Best Answer

As long as there is free memory available, the system will never use swap. In fact, swapping should be avoided in a system as possible...

On the other hand, in your case, it seems that you don't have a swap partition. Otherwise you should see something like this:

$ swapon -s 
Filename                Type        Size    Used    Priority
/dev/sdb1                               partition   1952764 0   -1
Related Question