Thursday, January 5, 2017

How much swap space should the Linux/Redhat system have?

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory. Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

However, modern systems often include hundreds of gigabytes of RAM. As a consequence, recommended swap space is considered a function of system memory workload, not system memory.

Amount of RAM in the system
Recommended swap space
Recommended swap space if allowing for hibernation
 2 GB
2 times the amount of RAM
3 times the amount of RAM
> 2 GB – 8 GB
Equal to the amount of RAM
2 times the amount of RAM
> 8 GB – 64 GB
At least 4 GB
1.5 times the amount of RAM
> 64 GB
At least 4 GB
Hibernation not recommended