출처 :
https://access.redhat.com/knowledge/solutions/15244
번역요약
RHEL 계열에서의 권장 SWAP 크기는?
예전에는 물리적인 메모리에 2배를 잡아주는게 일반적이였지만 메모리양이 증가하면서 크기별로 권장하는 최소(Minimum) 공간이 나오게 되었습니다.
이는 권장 최소값이라는 의미이지 실제 그만큼만 사용한다는것은 아니므로 메모리를 많이 쓰는 환경이라면 보다 여유있게 잡아주는것이 좋습니다.
즉 swap 공간은 파티션 크기가 허용하는 한도까지 사용할실수 있다고 보시면 되겠으며 크게 잡더라도 실제 환경에서 그만큼의 대량의 데이터를 Swap in/out 한다면 성능저하가 심각하게 발생할 수 있기에 물리적인 메모리를 늘려서 해결하는것이 일반적입니다.
If I add several hundred GB of RAM to a system, do I really
need several hundred GB of swap space for
RHEL?
Issue
• If add several hundred
GB of RAM to a system, do really need several hundred GB of swap space?
•
What are the recommended swap size settings for Red Hat Enterprise Linux 5 or
Red Hat Enterprise Linux
6?
Environment
• Red
Hat Enterprise Linux 5
• Red Hat Enterprise Linux
6
Resolution
Currently Red Hat recommends a linear
increase to the amount of swap space on a system
as the amount of RAM
increases. Specifically, that swap space on a system be twice the
amount of
RAM when the system has up to 2 GB and the amount of RAM plus 2 GB when
the
system has more than 2GB of RAM. This is pretty much the same recommendation
as
upstream so the reasoning behind it is, the larger the system, the larger
memory workload
that system will likely encounter.
This no longer makes
sense as memory sizes have increased into the hundreds of GBs.
The reality is
the amount of swap space a system needs is not really a function of
the
amount of RAM it has but rather the memory workload that is running on
that system. A Red
Hat Enterprise Linux 5 system will run just fine with no
swap space at all as long as the sum
of anonymous memory and system V shared
memory is less than about 75% the amount of
RAM. In this case the system will
simply lock the anonymous and system V shared memory
into RAM and use the
remaining RAM for caching file system data so when memory is
exhausted the
kernel only reclaims pagecache memory.
Considering that
1. At
installation time when configuring the swap space there is no easy way to
predetermine the memory a
workload will require, and
2. The more RAM a
system has the less swap space it typically needs, a better swap space
requirements
rule for Red Hat Enterprise Linux 5 is:
• Systems
with 4 GB of ram or less require a minimum of 2 GB of swap space
• Systems
with 4 GB to 16 GB of ram require a minimum of 4 GB of swap space
• Systems
with 16 GB to 64 GB of ram require a minimum of 8 GB of swap space
• Systems
with 64 GB to 256 GB of ram require a minimum of 16 GB of swap space