Adjusting SWAP/SWAPPINESS
Swap by default in Zorin OS is set to 60%,
(This means your machine will swap at 40% of RAM capacity.( Excluding RAM Cache.)
- To check what your setting of Swappiness, is set too
cat /proc/sys/vm/swappiness
- To check your your current Swap setting/usage:
free -m
- To Change/Add/Edit Swappiness,
1st Open the file when your editor, In this case it is "nano",
sudo nano /etc/sysctl.conf
Then scroll to the last line ( bottom) a you need to add the below line:
vm.swappiness=0
^^^(Add your desired setting, 10,15,20/etc)
Then Hold Ctrl & click x to save the changes.
Then y to confirm the changes.
Then Enter to Exit the file.
Then
reboot
-------------------- Notes ----------------------
-
Swappiness=0
^^^^^^^^^ ( only uses swap when absolutely needed.) Best for SSD. -
Swappiness=20
^^^^^^^ ( will swap at 80% of your total RAM ) -
Swappiness=60
^^^^^^^ ( will swap at 40% of your total RAM ) -
Swappiness=100
^^^^^^ ( will swap all the time )
"Swap, Can & will use swap outside of these settings,
No matter what your Swappiness is set to."
Eg:
The default is "swappiness=60" ( set to help at 40% of RAM usage).
The machine is using 20%, & a program that needs 15% of RAM, Starts up, This equals 35%, but on startup, the computer new program may use 18% (Spike) Although you physically haven't used 40% or RAM,
The computer detects that it is getting close & preparers (sometimes writing swap prior to settings) to start swapping.
RAM Files that are moved to a Swap File are normally the least used program running ( being used).
- Quote:
"Unused RAM, is Wasted RAM"
So if possible, Best to upgrade the RAM Capacity.