Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 2176  / 3 Years ago, sun, june 27, 2021, 10:13:59

I'm trying to debug an OOM situation in an Ubuntu 12.04 server, and looking at the Memory graphs in Landscape, I noticed that there wasn't any serious memory usage spike. Then I looked at the output of the free command and I wasn't quite sure how both memory usage results relate to each other.



Here's landscape's output on the server:



$ landscape-sysinfo 
System load: 0.0 Processes: 93
Usage of /: 5.6% of 19.48GB Users logged in: 1
Memory usage: 26% IP address for eth0: -
Swap usage: 2%


Then I ran the free command and I get:



$ free -m
total used free shared buffers cached
Mem: 486 381 105 0 4 165
-/+ buffers/cache: 212 274
Swap: 255 7 248


I can understand the 2% swap usage, but where does the 26% memory usage come from?


More From » server

 Answers
1

In Landscape



landscape-sysinfo actually gets its data directly from /proc/meminfo:



dpb@helo:~$ cat /proc/meminfo |egrep 'MemTotal:|Active:'
MemTotal: 12286760 kB
Active: 3794832 kB
dpb@helo:~$


The calculation of "Memory Usage" in this case would be:



((MemTotal - Active) / MemTotal) * 100


You can see these calculations in:



/usr/share/pyshared/landscape/sysinfo/memory.py
/usr/share/pyshared/landscape/lib/sysstats.py


gets its data directly from /proc/meminfo:



In free



The free utility also gets its data directly from /proc/meminfo:



Mem




  • total: MemTotal

  • used: MemTotal - MemFree

  • free: MemFree

  • buffers: Buffers

  • cached: Cached



Buffers/cache




  • used: MemTotal - MemFree - Buffers - Cached

  • free: MemFree + Buffers + Cached



Swap




  • total: SwapTotal

  • used: SwapTotal - SwapFree

  • free: SwapFree



Total




  • total: MemTotal + SwapTotal

  • used: MemTotal - MemFree + SwapTotal - SwapFree

  • free: MemFree + SwapFree



Corrected cached -- lzap


[#33974] Sunday, June 27, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
issfullus

Total Points: 264
Total Questions: 126
Total Answers: 107

Location: Comoros
Member since Mon, Dec 19, 2022
1 Year ago
;