Add

Monday, 7 October 2013

Swap out your old thinking about Swap Space in LINUX/UNIX


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 (Discuss in other next sections of configuring swap).

Old dumb memory managers : the '2x swap space' rule came from Old Solaris and Windows admins. Also, earlier memory mangers were very badly designed. There were not very smart. Today, we have very smart and intelligent memory manager for both Linux and UNIX.

Nonsense rule: Twice the size of your main system RAM for Servers


Here is most common rule for normal server:
My friend who is a true Linux GURU recommends something as follows for heavy duty server


RAM Size     <     2GB
RAM Size    >     2GB
RAM Size   <     8GB
Swap space = Equals  the RAM size (Desktop & Laptop )
Swap space = Equals to RAM size
Swap space == 0.50 times the size of RAM
Swap space = 2 times  the RAM : suspend to disks (Hibernate/sleep/memory Applications) Kernel hackers(debugging and fixing kernel issues) and generating core dumps



Note: The size of your swap should never be less than 32 MB, Select right size for your setup


Conclusion

If Linux kernel is going to use more than 2GiB swap space at a time, Get yours hand dirty to replace old with more RAM (recommend) and move to faster storage to improve disk I/O. 

No comments:

Post a Comment