리눅스 서버 캐시 비우기 : sudo sync && sudo sysctl -w vm.drop_caches=2
1. 캐시 비우기 전 동기화 작업 : sudo sync
2. 캐시비우기 : sudo sysctl -w vm.drop_caches=2
1번 성공 후 2번 진행 : sudo sync && sudo sysctl -w vm.drop_caches=2
drop_caches 옵션 상세 설명
링크 : https://www.kernel.org/doc/Documentation/sysctl/vm.txt
drop_caches
Writing to this will cause the kernel to drop clean caches, as well as
reclaimable slab objects like dentries and inodes. Once dropped, their
memory becomes free.
To free pagecache: echo 1 > /proc/sys/vm/drop_caches
To free reclaimable slab objects (includes dentries and inodes): echo 2 > /proc/sys/vm/drop_caches
To free slab objects and pagecache: echo 3 > /proc/sys/vm/drop_caches
This is a non-destructive operation and will not free any dirty objects.
To increase the number of objects freed by this operation, the user may run
`sync' prior to writing to /proc/sys/vm/drop_caches. This will minimize the
number of dirty objects on the system and create more candidates to be
dropped.
This file is not a means to control the growth of the various kernel caches
(inodes, dentries, pagecache, etc...) These objects are automatically
reclaimed by the kernel when memory is needed elsewhere on the system.
Use of this file can cause performance problems. Since it discards cached
objects, it may cost a significant amount of I/O and CPU to recreate the
dropped objects, especially if they were under heavy use. Because of this,
use outside of a testing or debugging environment is not recommended.
You may see informational messages in your kernel log when this file is
used:
cat (1234): drop_caches: 3
These are informational only. They do not mean that anything is wrong
with your system. To disable them, echo 4 (bit 2) into drop_caches.
'System > 명령어' 카테고리의 다른 글
[명령어] swap 초기화 : swapoff -a && swapon -a (0) | 2023.10.30 |
---|---|
[명령어] swap 추가/삭제 (1) | 2023.10.30 |
[명령어] pid값 가져와서 prlimit for문으로 돌리기 (0) | 2023.01.12 |
[명령어] tail - 실시간 로그 확인하기 (0) | 2021.05.18 |
[명령어] if fi - 디렉토리가 없으면 디렉토리 생성 (0) | 2021.05.18 |