Two importance of swapping memory is as, first like when system requres more memory than it is static available, the kernel swaps out less used pages and provides memory to the application and second is a number of pages used application in startup phase may only be used for intialziation and not used again. System swap out pages and free the memory for other resources.
So many people use old method that swap partition should be twice the size of system.On current era that is a lot of swap,most of the systems never swap.People don’t want his system to ever run out of memory ( RAM + SWAP) ,but they usually would rather have much enough RAM in the system so it doesn’t need to swap.
If we add large amount of RAM in a system, we don’t need to extend large amount of swap space.
Why we need swap partition file system ?
When physical memory ( RAM) is full , then system needs more resources memory . Swap will used when the amount of physical memory is full then inactive pages in memory are moved to the swap filesystem .
The amount of swap memory recommended for linux depends on some factors including the amount of memory in the system and the work load on the memory.
Red Hat SWAP Memory Recommendation
2GB of RAM requires 2 times the amount of RAM
2GB-8GB RAM requires Equal to the amount of RAM
8GB to 64GB of RAM requires 0.5 times the amount of RAM
64GB of RAM requires 4 GB of swap space
Red Hat recommended swap space if allowing for hibernation
2GB of RAM requires 3 times the amount of RAM
2GB-8GB RAM requires 2 times the amount of RAM
8GB to 64GB of RAM requires 1.5 times the amount of RAM
64GB of RAM requires No extra space needed