리눅스 메모리 사용률 확인

(리눅스 메모리 사용률에서 넘어옴)
리눅스 메모리 사용량 확인
리눅스 메모리 사용률 확인
Linux 메모리사용률

1 sar[ | ]

명령어
sar -r 1
실행예시
[root@zetawiki01 ~]# sar -r 1
Linux 2.6.30.10-105.2.23.fc11.x86_64 www.jmnote.com) 	05/06/2012

12:54:07 PM kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
12:54:08 PM     42440    490744     92.04     65124    168916   1146744       128      0.01        16
Average:        42440    490744     92.04     65124    168916   1146744       128      0.01        16

→ 명목 메모리사용률(%memused)은 92.04%이다.

2 free[ | ]

명령어
free
실행예시 1
[root@zetawiki01 ~]# free
             total       used       free     shared    buffers     cached
Mem:        533184     490736      42448          0      65264     168936
-/+ buffers/cache:     256536     276648
Swap:      1146872        128    1146744
메모리사용률 계산
명목 [math]\displaystyle{ usage\%=\dfrac{used}{total} }[/math][math]\displaystyle{ = \dfrac{490736}{533184} = 0.9204 = 92.04\% }[/math]
실질 ★ [math]\displaystyle{ usage\%=\dfrac{used-buffers-cached}{total} }[/math][math]\displaystyle{ =\dfrac{490736-65264-168936}{533184} }[/math][math]\displaystyle{ = 0.4811 = 48.11\% }[/math]
실행예시 2
# free
              total        used        free      shared  buff/cache   available
Mem:         980744      260528      188012         716      532204      571160
Swap:       4194300        6656     4187644
메모리사용률 계산
명목 [math]\displaystyle{ usage\%=\dfrac{total-free}{total} }[/math][math]\displaystyle{ = \dfrac{980744-260528}{980744} = 0.7344 = 73.44\% }[/math]
실질 ★ [math]\displaystyle{ usage\%=\dfrac{total-available}{total} }[/math][math]\displaystyle{ =\dfrac{980744-571160}{980744} }[/math][math]\displaystyle{ = 0.4176 = 41.76\% }[/math]

3 top[ | ]

명령어
top -n1 | grep Mem
실행예시 1
[root@zetawiki01 ~]# top -n1 | grep Mem
Mem:    533184k total,   494296k used,    38888k free,    64920k buffers
메모리사용률 계산
명목 [math]\displaystyle{ usage\%= \dfrac{total-free}{total} }[/math][math]\displaystyle{ = \dfrac{533184-38888}{533184} = 0.9271 = 92.71\% }[/math]
실질 ★ [math]\displaystyle{ usage\%=\dfrac{total-free-buffers}{total} }[/math][math]\displaystyle{ = \dfrac{533184-38888-64920}{533184} = 0.8053 = 80.53\% }[/math]
실행예시 2
testuser@ubuntu18:~$ top -n1 | grep Mem
KiB Mem :   980744 total,   185312 free,   261184 used,   534248 buff/cache
KiB Swap:  4194300 total,  4187644 free,     6656 used.   570476 avail Mem
메모리사용률 계산
명목 [math]\displaystyle{ usage\%= \dfrac{total-free}{total} }[/math][math]\displaystyle{ = \dfrac{980744-185312}{980744} = 0.8110 = 81.10\% }[/math]
실질 ★ [math]\displaystyle{ usage\%=\dfrac{total-avail}{total} }[/math][math]\displaystyle{ = \dfrac{980744-570476}{980744} = 0.4183 = 41.83\% }[/math]

4 meminfo[ | ]

명령어
cat /proc/meminfo | grep Mem
실행예시 1
[root@zetawiki01 ~]# cat /proc/meminfo | grep Mem
MemTotal:         533184 kB
MemFree:           41860 kB
메모리사용률 계산
명목 [math]\displaystyle{ usage\%= \dfrac{MemTotal-MemFree}{MemTotal} }[/math][math]\displaystyle{ = \dfrac{533184-41860}{533184} = 0.9215 = 92.15\% }[/math]
실행예시 2
testuser@ubuntu18:~$ cat /proc/meminfo | grep Mem
MemTotal:         980744 kB
MemFree:          184332 kB
MemAvailable:     570076 kB
메모리사용률 계산
명목 [math]\displaystyle{ usage\%= \dfrac{MemTotal-MemFree}{MemTotal} }[/math][math]\displaystyle{ = \dfrac{980744-184332}{980744} = 0.8120 = 81.20\% }[/math]
실질 ★ [math]\displaystyle{ usage\%=\dfrac{MemTotal-MemAvailable}{MemTotal} }[/math][math]\displaystyle{ = \dfrac{980744-570076}{980744} = 0.4187 = 41.87\% }[/math]

5 같이 보기[ | ]

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