What is Swap?
How much is really needed ?
Linux divides its physical memory (RAM) into chunks called pages. Swapping is the process whereby pages get transferred to a preconfigured hard disk area. The quantum of swap space is determined during the Linux installation process. This article is all about swap space, and explains the term in detail so that newbies don’t find it a problem choosing the right amount of it when installing linux
Swapping is required for two reasons:
- When more memory than is available in physical memory (RAM) is required by the system, the kernel swaps less used pages and gives the system enough memory to the run the application smoothly.
- Certain pages are required by the application only at the time of initialisation and never again. such files are transferred to the swap space as soon as the application access these pages.
Amount of swap space depends on the kind of application you run and kind of user you are
The following rules can effectively help to improve Linux’s performance on your system
For Normal Servers:
- Swap space should be equal to RAM size if RAM size is less than 2 Gb
- Swap space should be equal to 2 Gb if RAM size is greater than 2 Gb . ,
For heavy duty servers with fast storage requirements:
- Swap space should be equal to RAM size if RAM size is less than 8 Gb
- Swap space should be equal to 0.5 times the size of the RAM if the RAM size is greater than 8 Gb