"리눅스 메모리 사용률 확인"의 두 판 사이의 차이

잔글 (125.141.209.66(토론)의 편집을 Jmnote의 마지막 판으로 되돌림)
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(사용자 3명의 중간 판 34개는 보이지 않습니다)
4번째 줄: 4번째 줄:


==[[sar]]==
==[[sar]]==
;명령어
{{소스헤더|명령어}}
<source lang='bash'>
<syntaxhighlight lang='bash'>
sar -r 1
sar -r 1
</source>
</syntaxhighlight>


;실행예시
{{소스헤더|실행예시}}
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# 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
</source>
</syntaxhighlight>
메모리 사용률(%memused)은 92.04%이다.
명목 메모리사용률(%memused)은 92.04%이다.


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


;실행예시
{{소스헤더|실행예시 1}}
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# free
[root@zetawiki01 ~]# free
             total      used      free    shared    buffers    cached
             total      used      free    shared    buffers    cached
Mem:        533184    490736      42448          0      65264    168936
Mem:        533184    490736      42448          0      65264    168936
-/+ buffers/cache:    256536    276648
-/+ buffers/cache:    256536    276648
Swap:      1146872        128    1146744
Swap:      1146872        128    1146744
</source>
</syntaxhighlight>
{| 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}}
:<math>MemUsage=\frac{used}{total}\times100\%</math><math>=\frac{490736}{533184}\times100\%=92.04\%</math>
<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'
|+ 메모리사용률 계산
|명목
|<math>usage\%=\dfrac{total-free}{total}</math><math>= \dfrac{980744-260528}{980744} = 0.7344 = 73.44\%</math>
|-
|실질 ★
|<math>usage\%=\dfrac{total-available}{total}</math><math>=\dfrac{980744-571160}{980744}</math><math>= 0.4176 = 41.76\%</math>
|}


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


;실행예시
{{소스헤더|실행예시 1}}
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# 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
</source>
</syntaxhighlight>


;계산
{| class='wikitable'
:<math>MemUsage=\frac{used}{total}\times100\%</math><math>=\frac{494296}{533184}\times100\%=92.71\%</math>
|+ 메모리사용률 계산
| 명목 || <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}}
<syntaxhighlight lang='console'>
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
</syntaxhighlight>
 
{| 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]]==
;명령어
{{소스헤더|명령어}}
<source lang='bash'>
<syntaxhighlight lang='bash'>
cat /proc/meminfo | grep Mem
cat /proc/meminfo | grep Mem
</source>
</syntaxhighlight>


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


;계산
{{소스헤더|실행예시 2}}
:<math>MemUsage=\frac{MemTotal-MemFree}{MemTotal}\times100\%</math><math>=\frac{533184-41860}{533184}\times100\%=92.15\%</math>
<syntaxhighlight lang='console'>
testuser@ubuntu18:~$ cat /proc/meminfo | grep Mem
MemTotal:        980744 kB
MemFree:          184332 kB
MemAvailable:    570076 kB
</syntaxhighlight>
{| class='wikitable'
|+ 메모리사용률 계산
| 명목 || <math>usage\%= \dfrac{MemTotal-MemFree}{MemTotal}</math><math>= \dfrac{980744-184332}{980744} = 0.8120 = 81.20\%</math>
|-
| 실질 ★ || <math>usage\%=\dfrac{MemTotal-MemAvailable}{MemTotal}</math><math>= \dfrac{980744-570076}{980744} = 0.4187 = 41.87\%</math>
|}


==같이 보기==
==같이 보기==
77번째 줄: 131번째 줄:


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

2022년 12월 19일 (월) 10:53 기준 최신판

리눅스 메모리 사용량 확인
리눅스 메모리 사용률 확인
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 }}