리눅스 메모리 사용률 확인 편집하기

경고: 로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다. 로그인하거나 계정을 생성하면 편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.

편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.

최신판 당신의 편집
5번째 줄: 5번째 줄:
==[[sar]]==
==[[sar]]==
{{소스헤더|명령어}}
{{소스헤더|명령어}}
<syntaxhighlight lang='bash'>
<source lang='bash'>
sar -r 1
sar -r 1
</syntaxhighlight>
</source>


{{소스헤더|실행예시}}
{{소스헤더|실행예시}}
<syntaxhighlight lang='console'>
<source lang='console'>
[root@zetawiki01 ~]# 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
Linux 2.6.30.10-105.2.23.fc11.x86_64 www.jmnote.com) 05/06/2012
17번째 줄: 17번째 줄:
12:54:08 PM    42440    490744    92.04    65124    168916  1146744      128      0.01        16
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
Average:        42440    490744    92.04    65124    168916  1146744      128      0.01        16
</syntaxhighlight>
</source>
→ 명목 메모리사용률(%memused)은 92.04%이다.
→ 명목 메모리사용률(%memused)은 92.04%이다.


==[[free]] ==
==[[free]]==
{{소스헤더|명령어}}
{{소스헤더|명령어}}
<syntaxhighlight lang='bash'>
<source lang='bash'>
free
free
</syntaxhighlight>
</source>


{{소스헤더|실행예시 1}}
{{소스헤더|실행예시}}
<syntaxhighlight lang='console'>
<source lang='console'>
[root@zetawiki01 ~]# free
[root@zetawiki01 ~]# free
             total      used      free    shared    buffers    cached
             total      used      free    shared    buffers    cached
33번째 줄: 33번째 줄:
-/+ buffers/cache:    256536    276648
-/+ buffers/cache:    256536    276648
Swap:      1146872        128    1146744
Swap:      1146872        128    1146744
</syntaxhighlight>
</source>
{| class='wikitable'
|+ 메모리사용률 계산
|명목
|<math>usage\%=\dfrac{used}{total}</math><math>= \dfrac{490736}{533184} = 0.9204 = 92.04\%</math>
|-
|실질 ★
|<math>usage\%=\dfrac{used-buffers-cached}{total}</math><math>=\dfrac{490736-65264-168936}{533184}</math><math>= 0.4811 = 48.11\%</math>
|}
 
{{소스헤더|실행예시 2}}
<syntaxhighlight lang='console'>
# free
              total        used        free      shared  buff/cache  available
Mem:        980744      260528      188012        716      532204      571160
Swap:      4194300        6656    4187644
</syntaxhighlight>
{| class='wikitable'
{| class='wikitable'
|+ 메모리사용률 계산
|+ 메모리사용률 계산
|명목
|명목
|<math>usage\%=\dfrac{total-free}{total}</math><math>= \dfrac{980744-260528}{980744} = 0.7344 = 73.44\%</math>
|<math>usage\%=\frac{used}{total}\times100\%</math><math>=\frac{490736}{533184}\times100\%=92.04\%</math>
|-
|-
|실질 ★
|실질 ★
|<math>usage\%=\dfrac{total-available}{total}</math><math>=\dfrac{980744-571160}{980744}</math><math>= 0.4176 = 41.76\%</math>
|<math>usage\%=\frac{used-buffers-cached}{total}\times100\%</math><math>=\frac{490736-65264-168936}{533184}\times100\%</math><math>=\frac{256536}{533184}\times100\%</math><math>=48.11\%</math>
|}
|}


==[[top]]==
==[[top]]==
{{소스헤더|명령어}}
{{소스헤더|명령어}}
<syntaxhighlight lang='bash'>
<source lang='bash'>
top -n1 | grep Mem
top -n1 | grep Mem
</syntaxhighlight>
</source>


{{소스헤더|실행예시 1}}
{{소스헤더|실행예시 1}}
<syntaxhighlight lang='console'>
<source lang='console'>
[root@zetawiki01 ~]# top -n1 | grep Mem
[root@zetawiki01 ~]# top -n1 | grep Mem
Mem:    533184k total,  494296k used,    38888k free,    64920k buffers
Mem:    533184k total,  494296k used,    38888k free,    64920k buffers
</syntaxhighlight>
</source>
 
{| class='wikitable'
|+ 메모리사용률 계산
| 명목 || <math>usage\%= \dfrac{total-free}{total}</math><math>= \dfrac{533184-38888}{533184} = 0.9271 = 92.71\%</math>
|-
| 실질 ★ || <math>usage\%=\dfrac{total-free-buffers}{total}</math><math>= \dfrac{533184-38888-64920}{533184} = 0.8053 = 80.53\%</math>
|}


{{소스헤더|실행예시 2}}
{{소스헤더|실행예시 2}}
<syntaxhighlight lang='console'>
<source lang='console'>
testuser@ubuntu18:~$ top -n1 | grep Mem
root@zetawiki02:~# top -n1 | grep Mem
KiB Mem :  980744 total,   185312 free,  261184 used,  534248 buff/cache
MiB Mem :  3895.9 total,   264.8 free,  2375.7 used,  1255.5 buff/cache
KiB Swap: 4194300 total, 4187644 free,     6656 used.  570476 avail Mem
MiB Swap:     0.0 total,     0.0 free,     0.0 used.  1055.2 avail Mem  
</syntaxhighlight>
</source>
 
{| class='wikitable'
|+ 메모리사용률 계산
| 명목 || <math>usage\%= \dfrac{total-free}{total}</math><math>= \dfrac{980744-185312}{980744} = 0.8110 = 81.10\%</math>
|-
| 실질 ★ || <math>usage\%=\dfrac{total-avail}{total}</math><math>= \dfrac{980744-570476}{980744} = 0.4183 = 41.83\%</math>
|}


==[[meminfo]]==
==[[meminfo]]==
{{소스헤더|명령어}}
{{소스헤더|명령어}}
<syntaxhighlight lang='bash'>
<source lang='bash'>
cat /proc/meminfo | grep Mem
cat /proc/meminfo | grep Mem
</syntaxhighlight>
</source>


{{소스헤더|실행예시 1}}
{{소스헤더|실행예시 1}}
<syntaxhighlight lang='console'>
<source lang='console'>
[root@zetawiki01 ~]# cat /proc/meminfo | grep Mem
[root@zetawiki01 ~]# cat /proc/meminfo | grep Mem
MemTotal:        533184 kB
MemTotal:        533184 kB
MemFree:          41860 kB
MemFree:          41860 kB
</syntaxhighlight>
</source>
{| class='wikitable'
|+ 메모리사용률 계산
| 명목 || <math>usage\%= \dfrac{MemTotal-MemFree}{MemTotal}</math><math>= \dfrac{533184-41860}{533184} = 0.9215 = 92.15\%</math>
|}


{{소스헤더|실행예시 2}}
{{소스헤더|실행예시 2}}
<syntaxhighlight lang='console'>
<source lang='console'>
testuser@ubuntu18:~$ cat /proc/meminfo | grep Mem
root@zetawiki02:~# cat /proc/meminfo | grep Mem
MemTotal:         980744 kB
MemTotal:       3989444 kB
MemFree:          184332 kB
MemFree:          272536 kB
MemAvailable:     570076 kB
MemAvailable:   1083164 kB
</syntaxhighlight>
</source>
{| class='wikitable'
{| class='wikitable'
|+ 메모리사용률 계산
|+ 메모리사용률 계산
| 명목 || <math>usage\%= \dfrac{MemTotal-MemFree}{MemTotal}</math><math>= \dfrac{980744-184332}{980744} = 0.8120 = 81.20\%</math>
| 명목 || <math>usage\%= \frac{MemTotal-MemFree}{MemTotal}</math><math>= \frac{3989444-272536}{3989444} = 0.932 = 93.2%</math>
|-
|-
| 실질 ★ || <math>usage\%=\dfrac{MemTotal-MemAvailable}{MemTotal}</math><math>= \dfrac{980744-570076}{980744} = 0.4187 = 41.87\%</math>
| 실질 ★ || <math>usage\%=\frac{MemTotal-MemAvailable}{MemTotal}</math><math>= \frac{3989444-1083164}{3989444} = 0.728 = 72.8%</math>
|}
|}


131번째 줄: 97번째 줄:


[[분류: 리눅스]]
[[분류: 리눅스]]
[[분류:메모리 사용률]]

제타위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는 제타위키:저작권 문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다. 저작권이 있는 내용을 허가 없이 저장하지 마세요!

취소 편집 도움말 (새 창에서 열림)

이 문서에서 사용한 틀: