Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
240
rated 0 times [  240] [ 0]  / answers: 1 / hits: 278204  / 2 Years ago, thu, september 15, 2022, 8:27:35

I thought the whole essence of swap was to act as a temporary storage safety net when RAM was full but my swap partition is constantly being used even though I sometimes have as much as 3GB free RAM. Is this normal?


More From » kernel

 Answers
3

You could try changing your "swappiness" value:


From the Ubuntu's Swap FAQ:



What is swappiness and how do I change it?


The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.



  1. swappiness can have a value of between 0 and 100



  2. swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible. For Kernel version 3.5 and newer it disables swappiness.



  3. swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache




The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.


To check the swappiness value


cat /proc/sys/vm/swappiness

To change the swappiness value A temporary change (lost on reboot) with a swappiness value of 10 can be made with


sudo sysctl vm.swappiness=10

To make a change permanent, edit the configuration file with your favorite editor:


gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:


vm.swappiness=10

Save the file and reboot.



Run sudo sysctl --load=/etc/sysctl.conf after editing the file to apply the changes


Also you can check out: https://askubuntu.com/a/103916/54187


[#37188] Friday, September 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
damomnning

Total Points: 422
Total Questions: 90
Total Answers: 106

Location: Mali
Member since Thu, Aug 13, 2020
4 Years ago
;