"리눅스 캐시 메모리 비우기"의 두 판 사이의 차이

 
(사용자 4명의 중간 판 17개는 보이지 않습니다)
4번째 줄: 4번째 줄:


==명령어==
==명령어==
{{소스헤더|pagecache 해제}}
<source lang='bash'>
<source lang='bash'>
sync; echo 3 > /proc/sys/vm/drop_caches
echo 1 > /proc/sys/vm/drop_caches
</source>
{{소스헤더|dentries, inodes 해제}}
<source lang='bash'>
echo 2 > /proc/sys/vm/drop_caches
</source>
{{소스헤더|pagecache, dentries, inodes 모두 해제}}
<source lang='bash'>
echo 3 > /proc/sys/vm/drop_caches
</source>
{{소스헤더|플러싱하기}}
<source lang='bash'>
sync
</source>
</source>


==실행예시==
==실행예시==
<source lang='dos'>
<source lang='console'>
[root@jmnote ~]# cat /proc/sys/vm/drop_caches
[root@zetawiki ~]# cat /proc/sys/vm/drop_caches
0
0
</source>
</source>
<source lang='dos'>
:→ drop_caches의 기본값은 0 (=캐시 메모리를 drop하지 않음)
[root@jmnote ~]# free -m
<source lang='console'>
[root@zetawiki ~]# free -m
             total      used      free    shared    buffers    cached
             total      used      free    shared    buffers    cached
Mem:          3881      1183      2698          0        156        617
Mem:          3881      1183      2698          0        156        617
20번째 줄: 34번째 줄:
Swap:        6063          0      6063
Swap:        6063          0      6063
</source>
</source>
<source lang='dos'>
:→ 버퍼 156MB, 캐시 617MB 사용중
[root@jmnote ~]# sync; echo 3 > /proc/sys/vm/drop_caches
<source lang='console'>
[root@jmnote ~]# cat /proc/sys/vm/drop_caches
[root@zetawiki ~]# echo 3 > /proc/sys/vm/drop_caches
[root@zetawiki ~]# cat /proc/sys/vm/drop_caches
3
3
</source>
</source>
<source lang='dos'>
:→ drop_caches를 3으로 조정 (=pagecache, dentries, inodes 캐시 메모리 영역을 해제)
[root@jmnote ~]# free -m
<source lang='console'>
[root@zetawiki ~]# free -m
             total      used      free    shared    buffers    cached
             total      used      free    shared    buffers    cached
Mem:          3881        365      3516          0          0        21
Mem:          3881        365      3516          0          0        21
32번째 줄: 48번째 줄:
Swap:        6063          0      6063
Swap:        6063          0      6063
</source>
</source>
:→ 버퍼 0MB, 캐시 21MB 로 줄어듦


==같이 보기==
==같이 보기==
*[[리눅스 메모리 사용률 (명목 vs 실질)]]
*[[리눅스 메모리 사용률 (명목 vs 실질)]]
*[[/proc/sys/vm/drop_caches]]
*[[free]]


==참고 자료==
==참고==
*http://linux-mm.org/Drop_Caches
*http://people.arsc.edu/~kcarlson/software/man/drop_caches.html
*http://people.arsc.edu/~kcarlson/software/man/drop_caches.html
*http://unix.stackexchange.com/questions/17936/setting-proc-sys-vm-drop-caches-to-clear-cache


[[분류: 리눅스]]
[[분류: 리눅스]]
[[분류: 메모리]]
[[분류: 메모리]]

2020년 4월 21일 (화) 22:26 기준 최신판

리눅스 캐시 메모리 비우기
리눅스 캐시 메모리 줄이기
/proc/sys/vm/drop_caches

1 명령어[ | ]

pagecache 해제
echo 1 > /proc/sys/vm/drop_caches
dentries, inodes 해제
echo 2 > /proc/sys/vm/drop_caches
pagecache, dentries, inodes 모두 해제
echo 3 > /proc/sys/vm/drop_caches
플러싱하기
sync

2 실행예시[ | ]

[root@zetawiki ~]# cat /proc/sys/vm/drop_caches
0
→ drop_caches의 기본값은 0 (=캐시 메모리를 drop하지 않음)
[root@zetawiki ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3881       1183       2698          0        156        617
-/+ buffers/cache:        408       3472
Swap:         6063          0       6063
→ 버퍼 156MB, 캐시 617MB 사용중
[root@zetawiki ~]# echo 3 > /proc/sys/vm/drop_caches
[root@zetawiki ~]# cat /proc/sys/vm/drop_caches
3
→ drop_caches를 3으로 조정 (=pagecache, dentries, inodes 캐시 메모리 영역을 해제)
[root@zetawiki ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3881        365       3516          0          0         21
-/+ buffers/cache:        342       3538
Swap:         6063          0       6063
→ 버퍼 0MB, 캐시 21MB 로 줄어듦

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}