0

I have 5.4 GB of 6.8 GB usage of RAM and 927.5 MB of 976 MB of Swap memory. Even though i have 1.4 GB of RAM usage Ubuntu is using up all of the swap memory. Although the swap memory is using my SSD space it will be much slower than my RAM. Shouldn't it use up all the RAM and then occupy Swap ?Extreme Swap usage

3 Answers3

2

You can use sysctl vm.swappiness=10 to reduce the drastic swap rate. And you can switch on or off with swapoff -a and swapon -a with root privileges. If you want to use hibernation, suitable spot for swap space is twice the size of RAM size.

0

Edit /etc/sysctl.conf as root. Change or add this line to the file:

vm.swappiness = 5

One way to do this is by using sudo nano /etc/sysctl.conf in a terminal window.
Reboot the system after saving the edited file.

This will instruct the system to use swap memory only when RAM is used almost completely.

976 MB of swap memory is not enough. It should be increased to at least 4 GB.

Stormlord
  • 6,807
0

Ubuntu will use RAM. When this becomes limiting, currently unused segments of memory are moved to swap space. That memory will be retrieved from there only when needed again in active RAM. If not needed, it will just be kept in swap even if in the mean time more RAM is becoming available.

You did not provide any indication of the use of your machine that resulted in the memory state you show. The memory state of a linux machine is dependent on how the system has run and what the memory requirements have been thus far. For sure, a freshly booted machine with 6 GB RAM will not be using swap. Swap use will eventually grow depending on the memory needed by your computer use.

I would merely thrust your linux system, which employs SWAP to maximize efficient use of real RAM. Still, you may want to decrease the tendency to use swap by changing the swappiness value. This will decrease the tendency to swap away active applications and give you a subjective impression of more responsiveness, although some processes may be more limited because of less RAM.

vanadium
  • 97,564