출처 :
https://access.redhat.com/site/solutions/33226
Under what conditions will a Red Hat Enterprise Linux system use the swap space?
어느 상황에서 Red Hat Enterprise Linux 시스템이 swap 공간을 사용하는가?
환경
Red Hat Enterprise Linux 4
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 6
해결
스왑 공간에 영향을 주는 3가지 인자가 있습니다.
swap_tendency = mapped_ratio/2 + distress + vm_swappiness
============================================================
① vm.swappiness: default = 60
This controls how likely the vm is to swap out data (the higher the value, the more likely it is to swap).
이것은 vm의 데이터 스왑아웃 가능성을 컨트롤합니다.(기본값 60보다 더 높은 값이라면 스왑이 일어날 가능성이 더 많습니다)
To limit the size of page cache, decrease this value so the kernel is less likely to swap and thus more likely to write data out to disk.
page cache 크기를 제한하기 위하여 이 값을 줄입니다. 그러면 커널은 스왑 가능성을 더 줄이며 데이터를 디스크(데이터 저장 영역인 ext3/4와 같은 "파일시스템 공간"을 의미)에 쓸 가능성이 증가합니다.
With modifications to these values, obviously there could come a significant change in behavior and performance of the system. It is recommend to modify them only slightly at first and testing each one thoroughly to ensure they do not have any negative effects.
이 값을 수정하면, 분명히 시스템의 동작과 성능에 큰 변화가 올 수 있습니다. 부정적 영향이 오지 않는지 확인하기 위하여 시작 시에만 약간, 그리고 각각의 테스트 시에는 철저히 수정할 것을 권장합니다.
② distress
Distress is a measure (from 0 - 100) of how much trouble the system is having reclaiming pages. It's detemined by '100 >> priority' where the priority will range from 12 (default) down to 0 (high priority). Memory reclaim will start with the default priority (distress level 0) and work towards a 0 priority (distress level 100) until it succeeds so the distress level increases as the memory reclaim struggles.
Distress는 시스템이 페이지를 회수하는 데에 얼마나 많은 트러블을 갖는 데에 대한 척도(from 0 - 100)입니다. 이것은 priority 12(default)부터 0(high priority)에 이르는 100 이하의 범위에서 결정됩니다. 메모리 reclaim은 default priority로 시작할 것이고 성공할 때까지 0 priority(distress level 100)를 향해 작동할 것이므로 distress level은 memory reclaim 시도를 통해 증가합니다.
③ mapped_ratio
The proportion of system memory that is mapped. The actual value of mapped_ratio equates sc->nr_mapped * 100 / total_memory.
매핑된 시스템 메모리 비율. mapped_ratio 실제 값은 아래 계산식과 동일합니다.
sc->nr_mapped * 100 / total_memory
============================================================
If the value of swap_tendency is less then 100, the kernel will only recalaim pagecache. If the value goes above 100, the kernel will start recalaiming process memory as well, i.e. start swapping application pages to disk.
만약 swap_tendency 값이 100보다 낮다면, 커널은 오직 pagecache만을 reclaim합니다. 만약 100을 넘는다면, 커널은 프로세스 메모리도 reclaim을 시작할 것입니다. 즉 어플리케이션 페이지를 디스크로 스와핑하는 것을 시작합니다.
2014/03/09 21:45
2014/03/09 21:45