So somewhere while installing your favorite Linux distro you came across the word “Swap” and now you are here to know what is Swap. Well, I will tell you it in the simplest sense.
What Is Swap Space?
Swap is a replacement or better say less used alternative for RAM( Random Access Memory). Let’s say that when you have 512mb RAM and you are running a game and RAM suddenly gets full. Then what? There comes the role of Swap. The OS moves the less used background running applications to Swap partition and frees up RAM so that you can run your favorite game easily.
The Swap partition is created on your hard drive. So 100% they are not as fast as RAM as the speed of RAM is so great that hard disk can match. So the apps running in Swap partition are simply slower (or worse) than the apps running in RAM. So you will think Swap as useless. Answer is No! But it is not also best. Let me show you in detail.
Actually, when your OS creates a Swap partition on your SSD, the system much of the time wants to keep the memory free. So mostly it continues to move the less frequent apps to Swap and keep up the memory free. So you can see that this can make that app or even whole system slower like a hell. Although you can put a check on it by decreasing swappiness, but that doesn’t work all the time.
So you might be thinking that Swap is the waste but No! It actually becomes helpful when you are out of RAM. Think about your mom old computer that has only 256-512mb RAM. How will she run her favorite apps? Here Swap comes as a saviour and lets you run your apps without any problem.
So what you might be thinking how to decide whether I need it or not!. Well here are some of my tips to decide and have the best use of swap.
There are also some situations that you won’t like to have Swap -
How much size should swap partition have?
If you are using Swap I recommend you should decrease it to 10-20% so that system access it some less frequently and you PC runs smooth cause too much swappiness cause extreme lag. Also, have less Swap partition size as too much Swap is also not god. There is a famous proverb in my country that “Know your limits when expanding feets”. So don’t create a heavy swap partition.
To decrease swappiness visit your community site and search method. Mostly all distro have a method to decrease swappiness easily or hardly.
Use a low requirement OS so much RAM stays free.
There aren't too many points about Swap. All you need to know is that is a type of Virtual RAM that you can create yourself if your SSD is way too faster like above 7000 rpm or better. I won’t advice you to use it below this limit as it will create no difference and will ultimately cause lag.
I actually recommend Swap if you have a low requirement system but also too much of something is never good. I use Swap in my mom’s PC as she has 512mb RAM only but not on mine as it has 4gb. It all depends on what you do with your system but keep things in control and you are good to go loose chain and have your SSD ripped off with heat to run faster.